The cause of 'Error while evaluating uicontrol Callback' in GUI window
Show older comments
I have encountered this error in running a GUI window that I have created. From what I have been able to discern online, it is caused by a problem with the handle structure but the piece of code that continues to be identified by matlab as the problem is this:
Error in new_window_2>pushbutton1_Callback (line 190)
set(handles.verticalBin, 'enable', 'on');
I have changed a number of lines in the code but i am not sure how this (or other set(handles, 'enable', '') statements) are causing an error. How might the handles structure be failing to work properly to generate this error?
2 Comments
Jan
on 24 May 2017
The handle struct is not the problem. Please post the complete error message. Currently we see only the part, which defines where the problem is, but not what.
Stephen23
on 25 May 2017
Good code does not use globals: "I have never seen MATLAB code where globals were the right thing to do.... Most of the time I have seen globals being used it was a situation where the code author did not understand scoping of variables. Rather than pass variables from one function to another, they were just being made global."
Note that using globals is a programming practice that will make your code very hard to debug. Passing arguments is much more robust, and is the recommended way of passing data between workspaces:
Accepted Answer
More Answers (1)
mohammadreza mahmoudi
on 18 Dec 2020
Edited: mohammadreza mahmoudi
on 18 Dec 2020
0 votes
hi dear friends and professors.
how can i solve this problem?
Error: label vector and instance matrix must be double
Unable to perform assignment because the indices on the left side are not compatible with the size of the rightn side.
Error in main>multisvm (line 991)
models(k) = svmtrain(TrainingSet,G1vAll);
Error in main>pushbutton14_Callback (line 866)
result = multisvm(data_feat,data_label,test_data);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in main (line 18)
gui_mainfcn(gui_State, varargin{:});
Errorin matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)main('pushbutton14_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
1 Comment
Jan
on 18 Dec 2020
Please open a new thread to ask a new question. This is the section for answers to another question.
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!