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

조회 수: 6 (최근 30일)
Jemuel Jeroham B
Jemuel Jeroham B 2020년 10월 21일
편집: Adam Danz 2020년 10월 23일
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일
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"

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by