Uitable: how to set number of rows/columns

16 ビュー (過去 30 日間)
Jethro
Jethro 2012 年 1 月 20 日
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 件のコメント
Michel KOPFF
Michel KOPFF 2012 年 3 月 22 日
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.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 1 月 20 日
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 件のコメント
Jethro
Jethro 2012 年 1 月 20 日
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 2012 年 1 月 20 日
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.

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

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by