Uitable column with popupmenu format returns NaNs rather than selection

I'm working with a uitable and, for one column, I need to make a selection from a cell array of strings. However, whenever I make a selection, NaN is returned to the table instead of the chosen string.
The below code replicates the problem:
fmt = {'A' 'B' 'C' 'D'};
uitable('Data',cell(2,2),...
'ColumnEditable',true(1,2),...
'ColumnFormat',{fmt,'Numeric'})
Am I specifying the 'ColumnFormat' property incorrectly, or is something else going on?

댓글 수: 1

Hello,
I am facing same problem. (NaN gets displayed if I select a entry from drop down list). Though I Understand that it is possible because of data type mismatch, I could not zeroed it down. Requesting for the help. (Actual Data will be assigned to table at run time)
Sample code:
columnname = {'Input Files','Output Files'};
columnformat = {'char', {'Fixed' 'Adjustable', 'Temp'}};
blank_data = cell(25,2);
% Create the uitable
htable = uitable('Data', blank_data,...
'ColumnWidth', {100 100},...
'ColumnName', columnname,...
'ColumnFormat', columnformat,...
'ColumnEditable', [true true]);

댓글을 달려면 로그인하십시오.

 채택된 답변

Matt Fig
Matt Fig 2012년 9월 27일
편집: Matt Fig 2012년 9월 27일
Try this out:
fmt = {'A' 'B' 'C' 'D'};
uitable('Data',{'A';'A'},...
'ColumnEditable',true(1,2),...
'ColumnFormat',{fmt});

댓글 수: 1

Evan
Evan 2012년 9월 27일
편집: Evan 2012년 9월 27일
Ah, thank you very much. I now see. I had missed the below bit in the help documentation about the popupmenu strings corresponding to 'Data':

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

질문:

2012년 9월 27일

댓글:

2015년 2월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by