How to display an array in uitable GUI when click "show table" button?

13 ビュー (過去 30 日間)
ws
ws 2011 年 11 月 17 日
Hi,
I want to show my 1x2 array in uitable by using one click button:
function button_show_table_Callback(hObject, eventdata, handles)
dat = [1 2 3 4 5];
set(handles.uitable_data, 'Visible', 'on');
h = uitable('Data', dat, 'ColumnFormat', 'numeric');
close(h);
guidata(hObject, handles);
Below is my error message: ColumnFormat must be a cell array
May I know what is the problem? Thank you.

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 11 月 17 日
1. 'ColumnFormat' needs to be a cell array, so use
h = uitable('Data', dat, 'ColumnFormat', {'numeric'});
2. It looks to me you already have a uitable in your GUI, why do you create another uitable? I think you should do:
set(handles.uitable_data, 'Visible', 'on');
set(handles.uitable_data, 'Data',dat, 'ColumnFormat',{'numeric'});
  1 件のコメント
ws
ws 2011 年 11 月 17 日
Thank you so much :)
It's works now..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by