Error using table2array -- Input argument must be a table.

When I run the below code, I get the error "Error using table2array (line 34)
Input argument must be a table."
app.store = table2array(app.UITable.Data);

2 件のコメント

Jemuel Jeroham B
Jemuel Jeroham B 2020 年 10 月 21 日
app.UITable.Data -- is a table.
Bruno Luong
Bruno Luong 2020 年 10 月 21 日
Type
dbstop if error
in command line. Run your app, when the error occurs, type
class(app.UITable.Data)
and see what returns

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

回答 (1 件)

Adam Danz
Adam Danz 2020 年 10 月 21 日
編集済み: Adam Danz 2020 年 10 月 23 日

0 投票

I don't see a question.
Apparently app.UITable.Data isn't a table. This can happen when the data are from the same class. In that case, you don't need table2array(). For example,
uif = uifigure();
uit = uitable(uif,'Data',magic(9)); % all numeric
>> uit.Data
ans =
47 58 69 80 1 12 23 34 45
57 68 79 9 11 22 33 44 46
67 78 8 10 21 32 43 54 56
77 7 18 20 31 42 53 55 66
6 17 19 30 41 52 63 65 76
16 27 29 40 51 62 64 75 5
26 28 39 50 61 72 74 4 15
36 38 49 60 71 73 3 14 25
37 48 59 70 81 2 13 24 35
uit2 = uitable(uif,'Data',string(magic(9))); % all strings
>> uit2.Data
ans =
9×9 string array
"47" "58" "69" "80" "1" "12" "23" "34" "45"
"57" "68" "79" "9" "11" "22" "33" "44" "46"
"67" "78" "8" "10" "21" "32" "43" "54" "56"
"77" "7" "18" "20" "31" "42" "53" "55" "66"
"6" "17" "19" "30" "41" "52" "63" "65" "76"
"16" "27" "29" "40" "51" "62" "64" "75" "5"
"26" "28" "39" "50" "61" "72" "74" "4" "15"
"36" "38" "49" "60" "71" "73" "3" "14" "25"
"37" "48" "59" "70" "81" "2" "13" "24" "35"

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

タグ

質問済み:

2020 年 10 月 21 日

編集済み:

2020 年 10 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by