cell array in a cell array inexing

1 view (last 30 days)
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.

Accepted Answer

Federico Zappaterra
Federico Zappaterra on 23 May 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};

More Answers (0)

Community Treasure Hunt

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

Start Hunting!