Problem with GUI when trying to run it
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
function Speed_Callback(hObject, eventdata, handles)
user_entry=str2double(get(hObject,'string'));
if isnan(user_entry)
errordlg('You must enter a numeric value','Bad Input','modal')
uicontrol(hObject)
return
end
% Proceed with callback
% hObject handle to Speed (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Speed as text
% str2double(get(hObject,'String')) returns contents of Speed as a double
% --- Executes during object creation, after setting all properties.
function Speed_CreateFcn(hObject, eventdata, handles)
% hObject handle to Speed (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in Calculate.
function Calculate_Callback(hObject, eventdata, handles)
string=get(Speed_Callbackhandle,'user_entry');
% hObject handle to Calculate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
user_entry=str2double(get(handles.Speed_Callback,'string')); % for example
user_entry =h;
Newfunction (h)
I am not understanding why I am still getting error messages
??? Undefined function or variable 'Speed_Callbackhandle'.
Error in ==> Stallfunction>Calculate_Callback at 105 string=get(Speed_Callbackhandle,'user_entry');
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> Stallfunction at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)Stallfunction('Calculate_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Respuestas (1)
Walter Roberson
el 9 de Mzo. de 2013
0 votos
3 comentarios
Achchuthan Ganeshanathan
el 9 de Mzo. de 2013
Walter Roberson
el 9 de Mzo. de 2013
At the end of your first routine, add
handles.user_entry = user_entry;
guidata(hObject, handles);
Then replace your last callback code with
h = handles.user_entry;
NewFunction(h);
Achchuthan Ganeshanathan
el 10 de Mzo. de 2013
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!