Error Message in uitable GUI

I have a editable uitable in a GUI. How can I check the user input data, and if the values are negative, display an error message?

回答(1 个)

Adam
Adam 2015-3-19

0 个投票

There's a CellEditCallback in which you can add whatever code you want in response to someone entering something in a cell of the table.

2 个评论

if any((data(:,1)) < 0)==1
warndlg('Must be greater than zero.','Warning!')
end
Where (data(:,1)) is column 1 of my uitable
I get the error:
Undefined function 'lt' for input arguments of type 'cell'.
Isn't 'data' a cell array from a uitable? In which case you need to apply cell operations or convert to a numerical array if it is pure numbers

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Logical 的更多信息

提问:

2015-3-19

评论:

2015-3-19

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by