sub2ind.m -- trying to use with a 2D matrix
1 view (last 30 days)
Show older comments
I have a matrix
data = rand(100,100);
I also have a index into that matrix
IDY = randperm(100);
I wish to reorder the data matrix by the order in IDY.
I thought sub2ind could help me, but I have not been able to get it working.
FYI: the matrix is a correlation matrix. Each element refers to a variable. I wish to "re-order" the correlation matrix according to the ordering in IDY.
thank you
0 Comments
Answers (2)
Azzi Abdelmalek
on 26 Nov 2013
Edited: Azzi Abdelmalek
on 26 Nov 2013
data(IDY)
Or maybe
data(IDY,:)
0 Comments
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!