Plot graph in GUI axes

1 Ansicht (letzte 30 Tage)
jyi
jyi am 9 Jun. 2012
Hi, I have two questions in mind.
1. I was using GUI Axes to plot a graph with this matlab code: set(hObject,plot(Z,speed));
and it gives me error as shown: ??? Error using ==> set Invalid parameter/value pair arguments.
Error in ==> race_profile>calc_Callback at 251 set(hObject,plot(Z,speed));
2. I read the thread on the feval(varargin{:}); error, I have changed the tag of the names, but it still gives me error like this.
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> race_profile at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)race_profile('calc_Callback',hObject,eventdata,guidata(hObject)) ??? Error while evaluating uicontrol Callback
Any idea why so? Thank you soooo much!

Antworten (2)

Walter Roberson
Walter Roberson am 9 Jun. 2012

AG
AG am 10 Jun. 2012
Errors like this:
Error in ==> @(hObject,eventdata)race_profile('calc_Callback',hObject,eventdata,guidata(hObject)) ??? Error while evaluating uicontrol Callback
may be caused by having renamed a .m file and its associated .fig file incorrectly. If you rename an .m and a .fig file by saving them with Save As and a new file name from GUIDE, GUIDE ensures that this problem does not occur. (This error may also occur if you delete a Callback or a CreateFcn in your code that is associated with a GUI object – I have not tested this)
The problem is that GUI objects (such as pushbuttons – I assume your 'calc' is a pushbutton) have lost their links to the function code. In GUIDE if you double click on the GUI object (your 'calc' pushbutton in this case) to open the property inspector, the Callback and CreateFcn fields may be empty. If they are empty, this is the source of the error.
You can fix this error in a GUI, but you have to fix it for each GUI object that has an associated Callback and a CreateFcn. If you just fix the one instance that is generating an error and try running again, you will get an error for the next GUI object that has the same error.
To fix this error, in GUIDE right click on the GUI object, then choose View Callbacks and then select Callback. When you do this, the link to the function is reestablished. You will also have to do this with View Callbacks>CreateFcn as well. After you do this, again look in the property inspector and you will see the link to the function is reestablished.
I have just fixed numerous instances of this problem in a GUI.

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by