The cause of 'Error while evaluating uicontrol Callback' in GUI window
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Jan
2017-5-24
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
2017-5-25
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:
采纳的回答
Jan
2017-5-24
Using globals is a really bad idea. This impedes the debugging, because you cannot find reliable, which code is resposnible for the last change. Do not use such an indirect method, but the handles struct, which is used for sharing other details already.
It is not clear, where the object of the handle handles.verticalBin is created. Are you sure that this field is existing in the handles struct?
11 个评论
Adam
2017-5-30
It can be difficult with some of these operators because as a beginner (sometimes as a more experienced user too) it can be hard to know what to type in the help to get to the right documentation page. Searching for just '=' or '==' does not yield anything so it is useful to know the function name equivalents to search e.g.
doc eq
The assignment operator is a tricky one though, I'm not aware it has a function-based equivalent given its nature and I must admit I gave up trying to work out where in the help it is introduced and defined. I'm sure it is somewhere linked from the Matlab introductory pages, but I didn't find it. Thankfully I know how it works so I don't need to find it on this occasion!
更多回答(1 个)
mohammadreza mahmoudi
2020-12-18
编辑:mohammadreza mahmoudi
2020-12-18
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 个评论
Jan
2020-12-18
Please open a new thread to ask a new question. This is the section for answers to another question.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!