Error using table2array -- Input argument must be a table.
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Bruno Luong
le 21 Oct 2020
Type
dbstop if error
in command line. Run your app, when the error occurs, type
class(app.UITable.Data)
and see what returns
Réponses (1)
Adam Danz
le 21 Oct 2020
Modifié(e) : Adam Danz
le 23 Oct 2020
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"
0 commentaires
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!