Problem with uitable with Logical cell and default value of 'true'
    조회 수: 2 (최근 30일)
  
       이전 댓글 표시
    
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#'}
댓글 수: 0
채택된 답변
  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
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!