cell array in a cell array inexing
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
HYZ
am 23 Mai 2020
Kommentiert: Federico Zappaterra
am 25 Mai 2020
Hi,
a = { [1:30] }. A {1} = { [1 2 3] [11 12 13] [21 22 23] }. A is resulted from a by extracting values from a.
b = { [41:70] }. I would like to get B = { [4142 43] [51 52 53] [61 62 63] } based on indexing from a and A.
I am confused from double indexing for cell array. I tried like B {1} = { b{1} (B {1})} and got error.
Could anyone help please ? thank you.
0 Kommentare
Akzeptierte Antwort
Federico Zappaterra
am 23 Mai 2020
I'm not sure about what are you looking for. However, I would do the following:
k1 = 1:3;
k2 = 6:9;
k3 = 11:13;
a{1} = [1:20];
A{1} = {a{1}k1 a{1}k2 a{1}k3};
b{1} = [31:50];
B{1} = {b{1}k1 b{1}k2 b{1}k3};
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!