필터 지우기
필터 지우기

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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by