필터 지우기
필터 지우기

Createfcn is not working during displaying an image in background?

조회 수: 1 (최근 30일)
Rafet
Rafet 2014년 8월 31일
편집: Image Analyst 2014년 8월 31일
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일
편집: 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