error in subplot

sir i have 15 images in a folder names,mri,i load this folder to perform 4 operations,low pass,high pass etc,
so there are 15 images in low and high pass amd so on,wen i subplot for each,15th low pass figure is repacles by first image oh gigh pass and so on,can u tell how to process please
pathname ='C:\mri\' ;
dirlist = dir( [pathname '*.tif'] );
pickind='tif';
for m = 1:length(dirlist)
i = imread([pathname, dirlist(m).name]);
A=i;
figure(1),subplot(4,4,m),imshow(A);
figure(2),subplot(4,4,m),imshow(B),title('low pass filter coefficients');
figure(3),subplot(4,4,m),imshow(C),title('high pass filter coefficients');

댓글 수: 6

Image Analyst
Image Analyst 2011년 10월 8일
I don't know what you're asking. Your code is badly formatted and I don't see an "end" for your "for" loop, nor do I see how you got B and C. But whatever, for each iteration you're showing A, B, and C all in the same m-th plot, thus overwriting each other. Again, I'm not sure what you tried to ask but that doesn't seem like something you'd want.
Image Analyst
Image Analyst 2011년 10월 8일
Oh, sorry, they're in the same mth position but on different figure windows. But what is your question?
FIR
FIR 2011년 10월 8일
http://imgur.com/lzWMR
i have uploaded my figure,in that 15th image i have error,that image must come in next figure
Jan
Jan 2011년 10월 8일
If you get an error, post the error message.
FIR
FIR 2011년 10월 8일
THE ERROR IS IN LAST IMAGE WHICH I HAVE UPLOADED
Jan
Jan 2011년 10월 8일
@FIR: There is no reason for shouting. I just want to help, but I need an exact description of the error. Usually "error" means, that Matlab stops the execution with a descriptive message in the command window. In this case, it is helpful to post a copy of this message.
If you have another problem, it would be helpful if you describe it with more details. "The error is in the last image" and "that image must come in next figure" does not contain the necessary details. Do you simply want to run the loop until 14 and open a new figure afterwards? Then:
if m==14, figure(4) ...
BTW, what is "B" and "C"?
Your code would be easier to read, if you apply the standard code formatting used in this forum. Follow the "Markup help" link to learn more.

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

 채택된 답변

Walter Roberson
Walter Roberson 2011년 10월 8일

0 개 추천

It is not a good idea to rely upon implicit parenting of a graphical object when you have more than one figure or axes (and a GUI is a figure for this purpose.) This is especially true in the debugging phase: if you stop in the middle of constructing the graphics, then there is a substantial chance that the "current figure" or "current axes" will change in between program statements.
f = figure(1); h = subplot(4,4,m,'Parent',f); imshow(h, A);
f = figure(2); h = subplot(4,4,m,'Parent',f); imshow(h, B); title(h, 'low pass filter coefficients');
f = figure(3); h = subplot(4,4,m,'Parent',f); imshow(h, C); title(h, 'high pass filter coefficients');

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

질문:

FIR
2011년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by