Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
What does m('ABC') do?

Subject: What does m('ABC') do?

From: Preet Desai

Date: 13 Apr, 2009 00:53:01

Message: 1 of 3

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)...
Where did 67 come from? Please help me out with this... or tell me what to search for, for more information.


Preet

Subject: What does m('ABC') do?

From: Roger Stafford

Date: 13 Apr, 2009 01:13:01

Message: 2 of 3

"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)...
> Where did 67 come from? Please help me out with this... or tell me what to search for, for more information.
>
> Preet

  Writing m('ABC') = [1 2 3] gives the same results as m([65,66,67]) = [1,2,3]; The values 65, 66, and 67 are the ASCII numerical equivalents of the letter 'A', 'B', and 'C'. How that relates to your bioinformatics functions I cannot say, except that letters are often used in identifying DNA nucleic acid sequences.

Roger Stafford

Subject: What does m('ABC') do?

From: Lucio Andrade-Cetto

Date: 13 Apr, 2009 12:00:17

Message: 3 of 3

"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)...
> Where did 67 come from? Please help me out with this... or tell me what to search for, for more information.
>
>
> 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

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us