Adding to a uitable

2 ビュー (過去 30 日間)
Jason
Jason 2011 年 2 月 22 日
I have read that you can add to a uitable by:
set(handles.uitable1,'data',s );
if I have a list of numbers I want to add to a row, not sure how to concatenate them to form the S in above code. Do they have to be delimited some way?
Thanks

採用された回答

Walter Roberson
Walter Roberson 2011 年 2 月 22 日
"s" above needs to be a cell array, one entry per table cell.
If you were to append a list of numbers to an existing row, that would make the table wider, except that it would probably complain about the cell array not being rectangular.
What you might be asking about, perhaps, is replacing some empty entries with values: that would be done using cell operations such as
[s{5,11:15}] = deal(num2cell([31 9 214.4 -8]));
If you are asking about adding another row, then you would (e.g.)
[s;num2cell([31 9 214.4 -8])]
  4 件のコメント
Jason
Jason 2011 年 2 月 22 日
Error I get is:
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> analyze_dir_works at 97
[s;num2cell([cycle f Sig(f,j)])]
Walter Roberson
Walter Roberson 2011 年 2 月 22 日
Your error message does not correspond to your code.
Anyhow, you would get that error if your entries were not all the same width. If you want to put in an incomplete row, you need to pad it out with empty cells to the width of the other rows. If you do not know what the maximum row width will be, you will need to add code to determine whether the s cell array needs to be expanded.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by