run through a cell content in single loop
Show older comments
Hello,
I try to get data from cell A by its index value(stored in B).
A = cell(1, 10);
B = [1 3 6 8];
How to get first 3rd, 6th, 8th cell content in a single loop?
I tried A{B}, it doesn't work.
If A is a large cell, A = cell(1, 50000); B = [many indice here], I got error:
AA = A(B);
??? Index exceeds matrix dimensions.
1 Comment
Daniel Shub
on 7 Mar 2011
Are you sure you did not screw something up?
A = cell(1, 50000);
B = randi(50e3, [1, 500e3]);
AA = A(B);
works fine for me. What is the max of your B?
Accepted Answer
More Answers (1)
REN
on 7 Mar 2011
0 votes
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!