Error with Guide opening

조회 수: 6 (최근 30일)
Jason
Jason 2014년 12월 11일
편집: Adam 2014년 12월 11일
What does this error mean.
I have a pushbutton 4 callback in my code mut not a CreatFn, so why is it complaining??
Error using feval
Undefined function 'pushbutton4_CreateFcn' for input arguments of type 'matlab.ui.control.UIControl'.
Error in gui_mainfcn (line 95)
feval(varargin{:});

채택된 답변

Adam
Adam 2014년 12월 11일
편집: Adam 2014년 12월 11일
It's complaining precisely because you don't have a create function.
If you go to the Property Inspector you will probably find that the CreateFcn field is not empty and has some automatically created function link in there for which it originally created the functyion body in your m-file. You can just delete that 'CreateFcn' entry of you want (as I tend top nowadays), but if you leave it there by default you must keep the CreateFcn in the .m file that is auto created.
  댓글 수: 2
Jason
Jason 2014년 12월 11일
Thankyou for pointing this out. What use is this for push buttons anyway?
Adam
Adam 2014년 12월 11일
편집: Adam 2014년 12월 11일
The default created function does some colour test based on the platform you are on and sets to the default colour of the system you are using if not 'PC'. I only ever use Windows so I decided I don't care about that!
You can put other code in there too if you want, but I've never found any situation in which I would want to. I initialise my ui control properties either in GUIDE itself or in the OpeningFcn.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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