How to number a set of row labels, then apply those numerical labels to a set of the same row labels that are in a different order?

1 Ansicht (letzte 30 Tage)
For example: matrix01 = abc123,GGAAFFVV;abc328,FFAATTRREEDD;abc9354,LSPSDKSDDD numerical_index_matrix01 = 1,GGAAFFVV;2,FFAATTRREEDD;3,LSPSDKSDDD
matrix02 = abc328,FFAATTRREEDD;abc123,GGAAFFVV;abc9354,LSPSDKSDDD numerical_index_matrix02 = 2,FFAATTRREEDD;1,GGAAFFVV;3,LSPSDKSDDD
So the order of these labels and their sequences is getting mixed up by external software, and I want to be able to use the initial numerical index scheme to index the new order, while reflecting the new order. Starts as a;b;c;d;e. Indexed as 1,a;2,b;3,c;4,d;5,e. Comes back as c;a;e;d;b and I want to get this result: 3,c;1,a;5,e;4,d;2,b.
This has my head spinning, any suggestions are appreciated.
  2 Kommentare
Jan
Jan am 21 Jun. 2011
What type is "c;a;e;d;b"? Are these cell strings or is this an abstract descritpion of a numerical vector? It would be helpful if you use proper Matlab syntax.
Adam Quintero
Adam Quintero am 21 Jun. 2011
Sorry. The letters are each a character string within a cell. The format for this example is a 5x2 cell matrix, with the header info in the first column and the corresponding character string in the second column.
I want to index a set of character strings with integers replacing the original header info. Next, I have a new 5x2 matrix of cells with the same headers, but in a different order. I want to now replace the headers in the first column in the new 5x2 matrix with the corresponding integers from the previous index, showing the change in numerical order between the two.
Hopefully this is more clear.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by