cell array in a cell array inexing

1 回表示 (過去 30 日間)
HYZ
HYZ 2020 年 5 月 23 日
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.

採用された回答

Federico Zappaterra
Federico Zappaterra 2020 年 5 月 23 日
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 件のコメント
Stephen23
Stephen23 2020 年 5 月 23 日
Federico Zappaterra
Federico Zappaterra 2020 年 5 月 25 日
Cool, I really didn't know about that! Thank you Stephen!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by