フィルターのクリア

How to store <500x500> double in a loop?

1 回表示 (過去 30 日間)
Ivan Shorokhov
Ivan Shorokhov 2015 年 2 月 12 日
コメント済み: Ivan Shorokhov 2015 年 2 月 13 日
I have following loop,
for e=1:25
:
:
:
finalLSF(e)=phi; % phi is where 500x500 double
end
How to store 500x500 double in a loop I have tried finalLSF(e) and finalLSF{e}, but it gives me an errors:
In an assignment A(I) = B, the number of elements in B and I must be the same.
and
Cell contents assignment to a non-cell array object.
How it is can be done properly in matlab?

採用された回答

Guillaume
Guillaume 2015 年 2 月 12 日
finalSF{e} should work. If you're getting an error, it's probably because finalSF already exists before the loop as something else than a cell array. To fix that:
finalSF = cell(1, 25); %before the loop.
Another option is to declare finalSF as a 3d array, since all your phi are the same size:
finalSF = zeros(500, 500, 25);
for idx = 1:25
%calculate phi
finalSF(:, :, e) = phi;
end
  1 件のコメント
Ivan Shorokhov
Ivan Shorokhov 2015 年 2 月 13 日
@Guillaume, thank you for such open answer!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by