Fast way to edit uitable cell?

1 次查看(过去 30 天)
Darin McCoy
Darin McCoy 2011-8-26
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?

回答(1 个)

Jan
Jan 2011-8-26
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.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by