MATLAB Answers

Fast way to edit uitable cell?

5 views (last 30 days)
Darin McCoy
Darin McCoy on 26 Aug 2011
Hi - i'm trying to edit a particular cell within a uitable whenever the user edits a different cell within uitable. My code looks like this
function editcell(varargin)
Entered = varargin{2};
S = varargin{3};
%Gets the row / col that the comment was entered in on
currow = Entered.Indices(1);
curcol = Entered.Indices(2);
%If you're entering in information into the comments area...
if curcol ==20
%Puts the usersID next to the comment
tempdata = get(S.table,'Data');
tempdata{currow,curcol} = Entered.EditData;
if isempty(Entered.EditData)
tempdata{currow,21} = '';
else
tempdata{currow,21} = getuserID;
end
elseif curcol ==22
%Puts the usersID next to the comment
tempdata = get(S.table,'Data');
tempdata{currow,curcol} = Entered.EditData;
if isempty(Entered.EditData)
tempdata{currow,23} = '';
else
tempdata{currow,23} = getuserID;
end
end
set(S.table,'Data',tempdata)
end
my problem is that
set(S.table,'Data',tempdata)
and
get(S.table,'Data')
cost a lot of time. Any ideas on how to edit the cell directly?

  0 Comments

Sign in to comment.

Answers (1)

Jan
Jan on 26 Aug 2011
There is a faster method using Java, but it is not convenient. Take a look on UndocumentedMatlab.com.
I suggest to send a message to the technical support and ask for much more powerful UITABLE and UITREE functions. There is an important demand to create GUIs with a high usability. And the reduced functionality of MATLAB's GUI elements is not state of the art. The more enhancement requests TMW gets, the more likely is it, that they consider the needs.

  1 Comment

Darin McCoy
Darin McCoy on 26 Aug 2011
ha - i have :)

Sign in to comment.

Sign in to answer this question.