How to display an error message in GUI?
显示 更早的评论
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?
采纳的回答
更多回答(2 个)
slumberk
2011-2-18
4 个评论
Matt Fig
2011-2-18
What are the dimensions of Mytable1? Is it a vector cell array, or cells within cells?
slumberk
2011-2-18
Matt Fig
2011-2-18
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
2011-2-18
all(cellfun(@isempty,Mytable1))
类别
在 帮助中心 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!