Effacer les filtres
Effacer les filtres

cell array in a cell array inexing

1 vue (au cours des 30 derniers jours)
HYZ
HYZ le 23 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.

Réponse acceptée

Federico Zappaterra
Federico Zappaterra le 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};
  2 commentaires
Federico Zappaterra
Federico Zappaterra le 25 Mai 2020
Cool, I really didn't know about that! Thank you Stephen!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by