uiTable Data to array

9 ビュー (過去 30 日間)
Lew Xiao Hui
Lew Xiao Hui 2020 年 11 月 20 日
コメント済み: Lew Xiao Hui 2020 年 11 月 25 日
How do I store these cell array obtain from app.UITable.Data into array?
4×5 cell array
{'100' } {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
{0×0 double} {0×0 double} {0×0 double} {0×0 double} {0×0 double}
These is what I got from the table, how to make it
a=100 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
because I wan to do calculation like (row1+ row2)

回答 (1 件)

Pratheek Punchathody
Pratheek Punchathody 2020 年 11 月 23 日
Hi Lew,
“table2array()” function can Convert table to homogeneous array.
ar = table2array(T); % T is the data in the form of table
Y=ar(1,:)+ar(2,:); % this calculates the sum of the row 1 and row 2 of the array and stores it in Y
Refer to the documentation of table2array for more information
Hope this helps.
  1 件のコメント
Lew Xiao Hui
Lew Xiao Hui 2020 年 11 月 25 日
Thanks for the reply!
But it still doesn't work.
I'm not sure what's the error. Here is the snaps for your reference.

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by