Effacer les filtres
Effacer les filtres

Converting between cell & matrix

1 vue (au cours des 30 derniers jours)
Jared
Jared le 19 Oct 2011
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.

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 19 Oct 2011
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);

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by