```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: What does m('ABC') do?
Date: Mon, 13 Apr 2009 12:00:17 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 31
Message-ID: <grv9gh\$fgc\$1@fred.mathworks.com>
References: <gru2dd\$tu\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1239624017 15884 172.30.248.35 (13 Apr 2009 12:00:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Apr 2009 12:00:17 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:532288

"Preet Desai" <preet.desai.nospam@matchworks.com> wrote in message <gru2dd\$tu\$1@fred.mathworks.com>...
> I'm trying to figure out how to make graphs with sparse matrices (like shown in the bionformatics functions), but I have no idea what
>
> m('ABC') = [1 2 3] does. I get a 1x67 matrix with the last three numbers (1,2,3)...
>
>
> Preet

Preet:
"m" is a convenience index vector that helps you define a graph when node IDs are characters, lets say you want to create a graph with three nodes ('A','B','C') and three edges ('A->B','C->A','B->C'), then you can use 'm' to create the indices for sparse:

sparse(m('ACB'),m('BAC'),1,3,3)

ans =

(3,1)        1
(1,2)        1
(2,3)        1

Of course you could have also use:

sparse([3 1 2],[1 2 3],1,3,3)

ans =

(3,1)        1
(1,2)        1
(2,3)        1

Lucio
```