I have a 30x30 matrix of numeric values. The horizontal and vertical coordinates are each the same 30 locations, with the values in the matrix being the distance between one location to another (x,y). I've calculated a 30x1 vector with a specific 'path' through the matrix locations. I am trying to create a set of 30 variables with the matrix values for 30 matrix coordinates, where each variable is the value of the coordinate in the matrix corresponding to (the first 'path' value, the next path value).
So given the distance matrix (dm) 30x30
and a 'path' vector 30x1 with a given order of the numbers 1 through 30
how to create 30 variables, each with the dm values of one path number to the next
example
6x6 matrix given path=[2;4;6;1;3;5] var01=matrix value at (2,4) var02=matrix value at (4,6) var03=matrix value at (6,1) var04=matrix value at (1,3) var05=matrix value at (3,5) var06=matrix value at (5,2) <------ last y value=first path value
This is applied in biology for ranking multiple sequence alignments. I am new to Matlab, and I appreciate any help with this problem, it is beyond my current skill level. This is for a project in my bioinformatics class, I'm going for a computational biology degree.
thx