MATLAB: Table in a modal window

modaltable

Is there a way to use a table in a modal window? (quick comment to summarize findings, started from GUIDE play button it does not work as described, started from a command line and then it works)
I have a table in a modal window and it is not displaying the 'Data' from the text cell structure that I am setting into it.
Problem Example
1) Use Matlab Menu -> File -> New -> GUI
2) Select "Modal Question Dialog"
3) In GUIDE, Edit figure, stretch it larger, move a few things around
4) Add button and a table (default 4×2 is fine)
5) Add code to button call back to put data in the table
function pbTest_Callback(hObject, eventdata, handles)
theDdata{1,1} = 'test 11';
theDdata{1,2} = 'test 12';
set(handles.tblTest, 'Data', theDdata);
6) run program
7) click button
Table goes to one row but does not have data. When I checked the get(..'Data') the values were set. So it is simply not displaying the data. If you change this figure to 'normal' then it displays the text.
Changing the figure to normal:
1) In GUIDE, change WindowStyle to normal
2) In code, Comment out 'uiwait' in uiTestModal_OpeningFcn
% uiwait(handles.figure1);
3) comment out 'delete' in uiTestModal_OutputFcn
% delete(handles.figure1);
Now the table shows the data when the button is clicked.
MATLAB Version 7.13.0.564 (R2011b) Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1) Java VM Version: Java 1.6.0_29-b11 with Sun Microsystems Inc. Java HotSpotâ„¢ 64-Bit Server VM mixed mode

Best Answer

It works fine here. Same specs as you have. Does this work?
function [] = modal_gui
% Help
S.fh = figure('units','pixels',...
'position',[500 500 200 260],...
'menubar','none',...
'name','modal_gui',...
'numbertitle','off',...
'resize','off',...
'windowstyle','modal');
S.tb = uitable('unit','pix',...
'position',[10 60 180 180],...
'fontsize',12);
S.pb = uicontrol('style','push',...
'units','pix',...
'position',[10 10 180 40],...
'fontsize',14,...
'string','Push Me',...
'callback',{@pb_call,S});
% uiwait(S.fh) % Either way, works here.
function [] = pb_call(varargin)
% Callback for pushbutton.
S = varargin{3}; % Get the structure.
TD = {'T11','T12';'T21','T22';'T31','T32';'T41','T42'};
set(S.tb, 'Data', TD);