how to equlaize cell arrays in matlab?
1 回表示 (過去 30 日間)
古いコメントを表示
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??
0 件のコメント
採用された回答
Pedro Villena
2012 年 10 月 30 日
編集済み: Pedro Villena
2012 年 10 月 30 日
A = [A cell(size(A))]; %%to duplicate a row array
A = [A; cell(size(A))]; %%to duplicate a column array
A = [A cell(1,3)]; %%to add 3 columns
A = [A; cell(3,1)]; %%to add 3 rows
その他の回答 (1 件)
Pedro Villena
2012 年 10 月 30 日
編集済み: Pedro Villena
2012 年 10 月 30 日
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'}
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Identification についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!