Uitable: how to set number of rows/columns
16 ビュー (過去 30 日間)
古いコメントを表示
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
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
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 件のコメント
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 Exchange で Dialog Boxes についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!