Worki ng with cells
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
soloby
am 26 Jun. 2015
Kommentiert: Walter Roberson
am 26 Jun. 2015
hey all,
i have a cell of <1x20> dimensions and each cell contains two x-values in a coordinate.
I want to work with these two coordinates separately, but I dont know how to access them?
Xidx1 =
Columns 1 through 5
[1x2 double] [1x2 double] [1x2 double] [1x2 double] [1x2 double]
Columns 6 through 10
[1x2 double] [1x2 double] [1x2 double] [1x2 double] [1x2 double]
Columns 11 through 15
[1x2 double] [1x2 double] [1x2 double] [1x2 double] [1x2 double]
Columns 16 through 20
[1x2 double] [1x2 double] [1x2 double] [1x2 double] [0]
1 Kommentar
Akzeptierte Antwort
Jan
am 26 Jun. 2015
Bearbeitet: Jan
am 26 Jun. 2015
Get the 2nd coordinate of the 3rd pair:
element = Xidx1{3}(2)
The power of a cell array is to store elements of different size and/or type. In your case only the last element contains a deviating contents. Is the [0] useful for anything? If not, you can concatenate the vectors to a matrix:
index = cat(1, Xidx1{1:end-1});
element = index(3, 2);
0 Kommentare
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Other Formats finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!