フィルターのクリア

Converting between cell & matrix

1 回表示 (過去 30 日間)
Jared
Jared 2011 年 10 月 19 日
I am trying to display a data table with uitable. I am using sprintf to control the data precision/format before I store the values in an 11 x n cell named tbl.
I try to generate the table with the following code:
f=figure('Position', [25 400 550 220],'NumberTitle','off','Name','Summary');
colnames={...};
rownames={...};
uitable(f, 'Data', tbl, 'ColumnName', colnames, 'RowName',rownames,'Position', [0 0 550 220]);
I get this error: ??? Error using ==> uitable Cell array of strings may only contain string and numeric matrices
I think it's because I am trying to put a cell instead of matrix into the uitable function. Tried using cell2mat thinking this might solve the problem, but get another error: ??? Error using ==> cat CAT arguments dimensions are not consistent.
I tried googling these answers but didn't find anything to lead me in the right direction.

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 10 月 19 日
Check the contents of your variable tbl. It shouldn't be any problem if none of its cell contains matrix or cells.
use celldisp(tbl) to show the contents. The following example works.
tbl={'a','b',1;2,3,'abc'};
uitable('Data',tbl);

その他の回答 (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