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!