How to display an error message in GUI?
Mostrar comentarios más antiguos
I have a figure of table. The user will insert a data into the table. If the user suddenly inserts the wrong data, the table will be 'NaN'. My question is how I want to make the table does not display 'NaN' on the table but I want an error message appear. I have this coding:
function Mytable1_CreateFcn(hObject, eventdata, handles)
if isnan(Mytable1)
set(hObject, 'Data', 0);
errordlg('Input must be a number','Error');
end
handles.Mytable2 = hObject;
guidata(hObject,handles);
But there is an error with this code. Is this coding are correct to answer my question?
Respuesta aceptada
Más respuestas (2)
slumberk
el 18 de Feb. de 2011
4 comentarios
Matt Fig
el 18 de Feb. de 2011
What are the dimensions of Mytable1? Is it a vector cell array, or cells within cells?
slumberk
el 18 de Feb. de 2011
Matt Fig
el 18 de Feb. de 2011
No, it is not a matrix. If it was a matrix, the error message wouldn't say,
"??? Undefined function or method 'isnan' for input arguments of type 'cell'."
Paulo Silva
el 18 de Feb. de 2011
all(cellfun(@isempty,Mytable1))
Categorías
Más información sobre Migrate GUIDE Apps en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!