Help with cell subsindex
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
FRANCISCO
am 12 Dez. 2013
Kommentiert: FRANCISCO
am 12 Dez. 2013
I have a matrix of 350 rows and a column that contains the number of (-1) that contains a specific pattern. I have a cell of 95 rows and one column and in each row I indicates a row number. How I can insert the numbers in the array of 350 elements corresponding to the rows indicated in cell 95 rows?
For example, I have a matrix?
A = [41, 12, 23, 34];
and I have the cell:
r = {[1, 2, 3], [2, 4] [1, 4]}
And the result I want is:
r2={ [41;12;23];[12;34];[41;34] }
Many thanks
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 12 Dez. 2013
Bearbeitet: Azzi Abdelmalek
am 12 Dez. 2013
A = [41, 12, 23, 34];
r = {[1, 2, 3], [2, 4] [1, 4]};
r2=cellfun(@(x) A(x),r,'un',0)
celldisp(r2)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!