Borrar filtros
Borrar filtros

Createfcn is not working during displaying an image in background?

1 visualización (últimos 30 días)
Rafet
Rafet el 31 de Ag. de 2014
Editada: Image Analyst el 31 de Ag. de 2014
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 comentarios
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh el 31 de Ag. de 2014
Editada: Salaheddin Hosseinzadeh el 31 de Ag. de 2014
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 el 31 de Ag. de 2014
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

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 31 de Ag. de 2014
Editada: Image Analyst el 31 de Ag. de 2014
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/

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by