How to save an array individually to avoid overwrite in a loop
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
So I managed to open sequence of files in Matlab using the following functions;
for k = 2010:2100
myfilename = sprintf('maxt_%d.pnt', k);
mydata = load(myfilename);
end
Here, because I don't save the array, the data gets overwritten and only show the last year data 'maxt_2100.pnt'. I tried mydata{k} within for loop but doesn't seem to work. Any idea how to save the data inside the loop individually so I can use them outside of the loop?
Thanks in advance
댓글 수: 0
채택된 답변
Walter Roberson
2016년 2월 4일
for k = 2010:2100
myfilename = sprintf('maxt_%d.pnt', k);
mydata{k-2010+1} = load(myfilename);
end
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!