how to equlaize cell arrays in matlab?
Show older comments
Hi,
I have a cellarray with length of 3 and I want to make for loop with another cell array with length of 6 , so how can I add extra 3 cells for the first array inorder to make the 2 cell arrays equal and to use my for loop in matlab??
Accepted Answer
More Answers (1)
Pedro Villena
on 30 Oct 2012
Edited: Pedro Villena
on 30 Oct 2012
type= { '12' '62' '5' };
colour={'red' 'green' 'yellow' 'brown' 'blue' 'black'};
result = type;
for i=length(type)+1:length(colour),
result(i)={'0'};
end
or
result = type;
result(length(type)+1:length(colour)) = {'0'}
Categories
Find more on Operators and Elementary Operations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!