Image not displayed when called by GUI

I adapted the two_axes GUI example in order to enter more variables and plot images with overlayed curves. Unlike the example, I opened a separate figure for plotting and import data for the images. The figures would open and a title would plot but no image was shown. I also don't get an error message to indicate any problem. I've used this .m script for years with no problem, but now that I've tried to drive it with a GUI, it doesn't work. The plotting program doesn't work as a function so I pasted it directly into the plot_button function but the behavior is the same. Could using a global command for accessing the image data, or the hold command for overlaying plots be a problem in the GUI mode? (I would include the files but don't see a way to attach them to this post.)
Steve

 채택된 답변

Walter Roberson
Walter Roberson 2011년 4월 26일

0 개 추천

We need sample code to be sure, but typically this kind of problem is caused by assuming that some particular figure or axis is the active figure (or axis) when it is not. You should be safe and explicitly code the parent object for every graphics operation.
fig = figure();
axno = axis('Parent',fig);
plot(axno,x,y);
hold(axno,'on');
plot(axno,x2,y2);

댓글 수: 1

Steven
Steven 2011년 4월 26일
Thanks for responding. How do I attach the files? Do you need the .mat image file too? It's 2MB.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by