Manipolation of Cell Arrays.
Show older comments
I have {A}=<250x22>cell. thanks to another question I'm able to know the pairs of two colums of {A} for example I have just these three combination :{a}&{b} or {b}&{z} or {r}&{t}. What I would like to create three different cell arrays based on the three combination.
Accepted Answer
More Answers (1)
Walter Roberson
on 19 Dec 2011
a_1 = strcmp('a', A(:,1));
b_1 = strcmp('b', A(:,1));
b_2 = strcmp('b', A(:,2));
r_1 = strcmp('r', A(:,1));
t_2 = strcmp('t', A(:,2));
mab = A(a_1 & b_2, :);
mbz = A(b_1 & z_2, :);
mrt = A(r_1 & t_2, :);
2 Comments
Fangjun Jiang
on 19 Dec 2011
Walter, what about http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F ?
Walter Roberson
on 19 Dec 2011
No loop variables were harmed in the making of this code snippet.
Categories
Find more on Dates and Time 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!