Invalid handle object, Please help!
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am programming a function for a edit text box that allows the user to input a min and max for the axes in a graph:
function edit1_Callback(hObject, eventdata, handles)
%Input X-Min value for axes1
user_entry = str2double(get(hObject, 'String'));
if isnan(user_entry)
errordlg('You must enter a numeric value.')
uicontrol(hObject)
return
end
set(handles.axes1, 'XLim', [user_entry Inf]);
guidata(hObject, handles);
However, I get a error message saying "Invalid handle object." at the set line. I suspect it has to do with the 'handles.axes1', but I'm not sure how to fix it. Can anyone help? Thanks in advance
3 comentarios
Walter Roberson
el 6 de Jun. de 2013
You have not given us reason to expect that handles.axes1 was ever created, let alone that reason to think it should still be valid. We are going to need to see more of the code, including the code for every routine you invoke between start-up and the time you run into that problem in the callback.
Respuestas (1)
Walter Roberson
el 6 de Jun. de 2013
It appears then that handles.axes1 was initialized, but that the axes was destroyed before you use it.
The probable reason for that is as described at the beginning of http://www.mathworks.co.uk/matlabcentral/answers/78221-problem-with-axes-handle#answer_87936
7 comentarios
Walter Roberson
el 6 de Jun. de 2013
Note that
handles.axes1 = axes('XScale', 'linear');
creates a new axis, rather than changing the current handles.axes1 to be linear.
Ver también
Categorías
Más información sobre Graphics Object Properties en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!