sub2ind.m -- trying to use with a 2D matrix

1 Ansicht (letzte 30 Tage)
Matlab2010
Matlab2010 am 26 Nov. 2013
Beantwortet: Sean de Wolski am 26 Nov. 2013
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

Antworten (2)

Azzi Abdelmalek
Azzi Abdelmalek am 26 Nov. 2013
Bearbeitet: Azzi Abdelmalek am 26 Nov. 2013
data(IDY)
Or maybe
data(IDY,:)

Sean de Wolski
Sean de Wolski am 26 Nov. 2013
data(IDY,:)
To reorder all rows or for columns
data(:,IDY)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by