필터 지우기
필터 지우기

How to save variables in a loop by changing the names

조회 수: 1 (최근 30일)
TheBeginner
TheBeginner 2013년 8월 14일
Hi,
I have the following problem :
  • I generate big 3D arrays on a powerful computer.
  • I want to use these arrays on a computer with much less memory.
The solution I've come up with is to divide my big array in small arrays and save them to a mat file. For exemple :
In file named 'toto', I would have 'array_1', 'array_2'...'array_N'
I have tried something lile :
for i=1:N
array_i= array(:,:,i); %array is the big 3D array
save('toto','array_i','-append');
end
But it obviously doesn't work since 'array_i' won't change at each loop.
Any idea?
Thank you

채택된 답변

Walter Roberson
Walter Roberson 2013년 8월 14일
  댓글 수: 2
TheBeginner
TheBeginner 2013년 8월 20일
Ok, I use the eval function to solve the problem. Thanks!
Iain
Iain 2013년 8월 20일
There's a few good reasons to avoid doing it in that way.
You may be better off by writing a binary file.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by