Getting error in my GUI when I run it

I'm trying to run my GUI, but I get the error:
The class handle has no Constant property or Static method named 'mcub'.
Error in interfaz_parte3_1>calcular_Callback (line 173)
y=str2num(get(handle.mcub,'string'));
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in interfaz_parte3_1 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)interfaz_parte3_1('calcular_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
I think is the way I'm introducing vectors.
This is part of my code:
% --- Executes on button press in calculate.
function calcular_Callback(hObject, eventdata, handles)
% hObject handle to calcular (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
costo=str2double(get(handle.costo,'string'));
y=str2double(get(handle.mcub,'string'));
x=str2double(get(handle.semanas,'string'));
CO=str2double(get(handle.bodega, 'string'));
where "y" and "x" are introduced as vectors (numbers) in an Edit box.
What is wrong with the vectors? How do I have to introduce them, or what do I have to change in the code so it can be read and used in the code as an input of a vector of numbers.
e.g. input=[1 2 3 4]

6 Comments

Cristina puedes adjuntar tus archivos? can you attach your files?
if you want to read vectors in an Editbox use "str2num" instead of "str2double" / si quieres leer vectores en un Editbox utiliza "str2num" en vez de "str2double" :
cost=str2num(get(handle.cost,'string'));
y=str2num(get(handle.mcub,'string'));
x=str2num(get(handle.semanas,'string'));
CO=str2num(get(hObject, 'string'));
Please post the complete error message.
Here it is. It still doesn't work with str2num
This is a rare example of a useless error message. It does neither tell in which line the error occurs, nor what the problem is. Are you sure that there are not more details?
Please tell us, when the error occurs. What do you do before?
I'm sorry, I didnt copied it all.
Here it is.
The class handle has no Constant property or Static method named 'mcub'.
Error in interfaz_parte3_1>calcular_Callback (line 173)
y=str2num(get(handle.mcub,'string'));
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in interfaz_parte3_1 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)interfaz_parte3_1('calcular_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
I only click on "Run", the graphic interface appears, then I introduce data and it shows me the error when I click my Pushbutton "Calcular".

Sign in to comment.

 Accepted Answer

You should be referring to handles.mcub not to handle.mcub

More Answers (1)

Unable to resolve the name vision.CascadeObjectDetector.
Error in main>BR_OWSE_Callback (line 647)
fd = vision.CascadeObjectDetector();
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in main (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)main('BR_OWSE_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating Menu Callback.
>> matlab.graphics.internal.figfile.FigFile.read
The class matlab.graphics.internal.figfile.FigFile has no Constant property or Static method named 'read'.
>>
How to solve this pblm ?

Categories

Find more on Creating, Deleting, and Querying Graphics Objects 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!