Error Message in uitable GUI

3 views (last 30 days)
laurie
laurie on 19 Mar 2015
Commented: Adam on 19 Mar 2015
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?

Answers (1)

Adam
Adam on 19 Mar 2015
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 Comments
laurie
laurie on 19 Mar 2015
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'.
Adam
Adam on 19 Mar 2015
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

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!