uitable - get data from numeric and logical cells altogether

1 次查看(过去 30 天)
Suppose I have a uitable containing a column with numerical values and several other columns containing a logical value (i.e. a checkbox).
When I try to acess the uitable data:
answer = get(hObject,'data');
the answer contains only the numerical column and ignores the logical values contained in the following columns.
Supposing I want to colect all the data from the table, including both numerical and logical results, would someone be able to tell me how to do it?

回答(2 个)

Doug Hull
Doug Hull 2011-2-9
K>> set(handles.uitable2,'data',{2, true, 't'; 3, false, 'h'})
K>> get(handles.uitable2,'data')
ans =
[2] [1] 't'
[3] [0] 'h'
This works. What were you doing?

PN
PN 2011-2-10
I have used the guide to assemble the uitable and set a couple of columns as numeric, and several other as logical. However, I left the values undefined.
Now, I realized I am able to set the numerical values and update them in the table... However, in regard to the logical values, I am unable to set them and thus edit the table in said columns.
Thanks for the help so far!
Edit:
the error message I am getting is:
Error in ==> gbtstruct>table_stnode_CreateFcn at 257
set(handles.table_stnode,'Data',{0, 0, true, true, true, true, false, false, true, false});

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by