Borrar filtros
Borrar filtros

Converting between cell & matrix

1 visualización (últimos 30 días)
Jared
Jared el 19 de Oct. de 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.

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 19 de Oct. de 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);

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by