フィルターのクリア

Problem with uitable with Logical cell and default value of 'true'

1 回表示 (過去 30 日間)
Nimrodb
Nimrodb 2013 年 3 月 13 日
I'm trying to build a uitable 1x2.
Cell(1,1) format is a 'logical'; Cell(1,2) is 'char'
handles.SeedTable = uitable(...
'ColumnName',{'Shuffle' 'Seed#'},...
'ColumnFormat',{'logical','char'},...
'ColumnEditable',[true true],...
'RowName',{'Seed'},...
'Data',[{'true'}, {'Random#'} ]);
When I run my file:
When I press the checkbox to uncheck cell(1,1) nothing happens. If i do not set the cell to be true by default - all is good (i.e. remove the line:
'Data',[{'true'}, {'Random#'}

採用された回答

Sean de Wolski
Sean de Wolski 2013 年 3 月 13 日
This is because 'True' is interpretted as a string for which any non-zero value is true. Thus it will always be true.
Replacing with true should resolve this:
uitable(...
'ColumnName',{'Shuffle' 'Seed#'},...
'ColumnFormat',{'logical','char'},...
'ColumnEditable',[true true],...
'RowName',{'Seed'},...
'Data',[{true}, {'Random#'} ]);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeElementary Math についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by