How to save, for loop
1 回表示 (過去 30 日間)
古いコメントを表示
Example:
for i=1:n X=DATA1(i,1); Y=DATA2{1,i}; Z=X-Y;
end
what I want is that it saves the data to Z, summing them, so, for i=1 , Z=[1 2 3 4 5], for i=2 Z becomes Z=[1 2 3 4 5 6 7] etc.
so i need to do something with Z but dont know what. currently it only shows the result of the last i.
2 件のコメント
Image Analyst
2012 年 12 月 14 日
Do you really have X as a numerical array (double, etc.) and Y as a cell array???
採用された回答
Pedro Villena
2012 年 12 月 14 日
編集済み: Pedro Villena
2012 年 12 月 14 日
for i=1:n,
X = DATA1(i,1); %%DATA1 is an array
Y = DATA2{i,1}; %%DATA2 is a cell
Z(i,:) = X-Y;
end
save Z
or
Z = DATA1 + cell2mat(DATA2);
save Z
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!