Store answers in multiple variables?

1 view (last 30 days)
I have a variable B which outputs about 100 cells. Assuming N = 4, how do I go about obtaining cell2mat(B(N(1)) in a new variable x_1, cell2mat(B(N(2)) in x_2, and so forth? Currently I am using:
for cnt = 1:N
hold on;
x = cell2mat(B(cnt));
Thanks in advance!
-- Jake
Jake Bolanski
Jake Bolanski on 1 Oct 2011
On a separate note, is there a function in MatLab that will allow me to detect colors within an image? I have broken down the image into a matrix via the imread() function. How can I go about detecting whether the leaf detected is green or yellow or so on? Thanks in advance.

Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 28 Sep 2011
"hold on" is for graphics. It has nothing to do your operation.
Depending on your cell array B, you may not need cell2mat. See this example:
Jake Bolanski
Jake Bolanski on 1 Oct 2011
Wow, very very very helpful! Thanks a bunch! :D

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!