Image not displayed when called by GUI

2 views (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 26 Apr 2011
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 Comment
Steven
Steven on 26 Apr 2011
Thanks for responding. How do I attach the files? Do you need the .mat image file too? It's 2MB.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!