error in subplot

조회 수: 2 (최근 30일)
FIR
FIR 2011년 10월 8일
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
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일
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개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by