plot multiple eval output

I was wondering how i could imagesc multiple slices into individual figures or subplots
for n=1:nframes
eval(['Fr' num2str(n) ' = slices(:,:,n)'])
%slices is a multislice 2d image
end
this will give if nframes 15 Fr1 to Fr15
should i do something like (this is well wrong)
or
n=1:nframes
figure
eval(['Fr' num2str(n) ' = slices(:,:,n)'])
%slices is a multislice 2d image
imagesc(Fr(n)) % can i do this how?
end

추가 답변 (1개)

Matt Fig
Matt Fig 2011년 3월 15일

1 개 추천

Use cell arrays instead, as the FAQ shows.
for n=1:nframes
figure
Fr{n} = slices(:,:,n);
imagesc(Fr{n})
end

댓글 수: 1

Kevin
Kevin 2011년 3월 18일
Thank you so much Matt. Sorry for being a pain but i have another question...Ok so actually i wanted to put a .m file in the loop but with three other arrays sig and acs.and af=2.However size(sig)=8,74,80,10 and size(acs)=8,20,80,10. The m-file outputs recon and ws how can one store recon & ws for n=1:10.
Sorry for the example:
for n=1:10
sig(n)=sig(:,:,:,n)
acs(n)=acs(:,:,:,n)
af=2
[recon,ws]=open(sig,acs,af) %m-file called open.m
% output recon(n) & ws(n)
end
Thank you so so much.

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2011년 3월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by