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 ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by