Createfcn is not working during displaying an image in background?

1 次查看(过去 30 天)
Hi,
I have a simple code to display an image in GUI background, but I cannot make it visible.
I just did the same thing with this video,
What can be the problem?
In addition I realized that matlab is not executing the createfcn callback of axes object.
Thanks in advance
Rafet
  2 个评论
Salaheddin Hosseinzadeh
编辑:Salaheddin Hosseinzadeh 2014-8-31
Hi Rafet,
Put the lines of the code related to displaying the code plz.
You should have something similar to this
plot(handles.axis1,Xdata,Ydata);
CreateFcn executes once, and that's only when the object is created so it won't execute repetitively just because the axis is viewed.
Rafet
Rafet 2014-8-31
thanks for your answer, I did not know that createfcn executes only once
to overcome this problem I put my code under openingfcn
it works

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2014-8-31
编辑:Image Analyst 2014-8-31
Your best bet is to just ignore all GUIDE CreateFcn() functions. Don't put any code into them. You can put code into the OpeningFcn, which executes once upon startup. Or you can put code into the OutputFcn() which executes once upon startup, after the OpeningFcn has run and after the FUI window has been made visible. OutputFcn also executes when the GUI shuts down. I really suggest you put lines like these into the functions to see when, and in what order, they are run:
fprintf('Now running OpeningFcn....\n'); % or OutputFcn or whatever...
Note, there are some lines of code that must be put into OutputFcn such as those to maximize the GUI window:
FigurejFrame = get(handle(gcf),'JavaFrame');
FigurejFrame.setMaximized(true);
Thanks to Yair for the above code http://undocumentedmatlab.com/

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by