Uitable: how to set number of rows/columns

16 visualizaciones (últimos 30 días)
Jethro
Jethro el 20 de En. de 2012
Hi guys!
I noticed that there's the possibility of creating tables... I tried to look Property Inspector items, but I didn't understand very much!
According to you there's the possibility to create tables with a variable number of rows and coloum??
For example, if I have an array, can I create a table with a number of rows equal to the length of my array? How can I do?? And what can you tell me about the same questions according to columns??
Thanks a lot!
  1 comentario
Michel KOPFF
Michel KOPFF el 22 de Mzo. de 2012
Hello!
I want an uitable with only one column.
a = {'A' ; 'B' ; 'C‘};
set(handles.table,'Data',a);
The uitable is shown with 2 columns.
b = get(handles.table,'Data');
b is a <3x1 cell> cell array.
What is the solution that the second column disappear in the uitable?
Thanks.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 20 de En. de 2012
If you are talking about uitable(), you change the number of rows or columns by set() a new Data property. If you are using something other than the defaults for properties such as ColumnFormat then you would want to update those properties as well.
  2 comentarios
Jethro
Jethro el 20 de En. de 2012
Uhm, yes I wanted to use set()... but I don't know what kind of parameters I have to add...
Can I do something like
set(handles.Table, 'ncolumns_param', length(array)); ????
Walter Roberson
Walter Roberson el 20 de En. de 2012
There is no property for the number of rows or columns. The size() of the cell array that is the Data property determines the number of rows and columns. For example if you wanted to add 2 columns,
d = get(handles.Table, 'Data');
d{1,end+2} = [];
set(handles.Table, 'Data', d);
Properties you might want to set() when you update the number of columns include: ColumnEditable, ColumnFormat, ColumnName, ColumnWidth. Properties that you might want to set() when you update the number of rows include: RowName .
There is no explicit specification of number of rows or columns, just the number figured out from the Data property.

Iniciar sesión para comentar.

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by