Passing variable to array name
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
I'm currently trying to pass variable N in to the name of an array. The process I'm coding is given below:
for N = 1:totalblocks
Output_{N} = ones(ttotal,cells);
if cells*N < ntotal
cells = cells;
Output_{N} = ones(ttotal,cells);
for j=1:ttotal
path = char(files(j).name);
fprintf('Merging %d of %d, from block %d\n',j-1,ttotal,N);
Output_{N}(j,:) = extractOMF_v1(nx,ny,nz,path,ntotal,N,cells);
end
else
cells = ntotal;
Output_{N} = ones(ttotal,cells);
for j=1:ttotal
path = char(files(j).name);
fprintf('Merging %d of %d, from block %d\n',j-1,ttotal,N);
Output_{N}(j,:) = extractOMF_v1(nx,ny,nz,path,ntotal,N,cells);
end
end
save(strcat('spatially_resolved_',num2str(N),'.txt'),strcat('Output_',num2str(N)),'-ascii')
end
So, let us just consider totalblocks = 1. Then I would like the array 'Output_N' to be named 'Output_1'. This will let me save multiple 'Output' arrays.
When I run this however, the array is simply named 'Output_N'. Does anyone know how I can get 'Output_1' as an output? I get the feeling I'm missing something very obvious!
Many thanks,
Carl
답변 (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!