Passing variable to array name

5 次查看(过去 30 天)
Carl
Carl 2013-12-18
评论: Carl 2013-12-19
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 CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by