MATLAB Answers

Detecting an empty uitable

24 views (last 30 days)
Beth
Beth on 10 Jul 2012
Hello,
I am developing a GUI which has several editable tables that correspond to optional parameters. I'm looking for a way to detect if the user has left the table empty. I tried using something like this:
data=get(handles.TestTable,'Data');
if data
disp('data is here')
else
disp('no data found')
end
But this gave the error 'Conversion to logical from cell is not possible.' Any help on how to handle this would be much appreciated.

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 10 Jul 2012
if all(cellfun(@isempty, data(:)))

  1 Comment

Beth
Beth on 11 Jul 2012
Thanks!

Sign in to comment.

More Answers (1)

John
John on 10 Jul 2012
try the command "isempty"
for example:
if isempty(data) == 0
disp('data is here')
else
disp('data is not here')
end

  0 Comments

Sign in to comment.

Sign in to answer this question.