Undefined operator '-' for input arguments of type 'table'.

33 ビュー (過去 30 日間)
Emre Yavuz
Emre Yavuz 2019 年 5 月 20 日
コメント済み: Peter Perkins 2019 年 5 月 21 日
Am very new to MatLab, have tried to run the One-sample Kolmogorov-Smirnov test
In response, the computer gave me this answer:
Undefined operator '-' for input arguments of type 'table'.
I would really appreciate some guidance!!

回答 (2 件)

Star Strider
Star Strider 2019 年 5 月 20 日
One option is to use the table2array (link) function to extract your table data to an array kstest can use.
  2 件のコメント
Emre Yavuz
Emre Yavuz 2019 年 5 月 20 日
Thanks so much! It's worked!
Star Strider
Star Strider 2019 年 5 月 20 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!

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


Peter Perkins
Peter Perkins 2019 年 5 月 20 日
Tables are containers, and can contain (almost) any data type. So they do not support all the methods that their contents support. In your case, you probably have a table with a numeric variable in it. Let's say it's called X. So instead of T - <something>, you'd type T.X - <something>.
You haven't provided enough contexst to say anything more than that.
  2 件のコメント
Emre Yavuz
Emre Yavuz 2019 年 5 月 20 日
Hey Peter,
Thanks so much for your advice!
The comment above:
One option is to use the table2array (link) function to extract your table data to an array kstest can use.
Seemed to work!
Peter Perkins
Peter Perkins 2019 年 5 月 21 日
Sure, it will certainly work.
You might have a table with only one variable in it. That's a little funny, because tables are all about collecting up multiple variables, possibly even of different types. But table2array will give you that one variable as a raw numeric array.
But you might have a table with multiple variables in it. You might want to do the test on just one of the variables. So kstest(t.X) is perhaps less work than converting the entire table. Or maybe you want to do the test on several of the variables in the table. varfun(@kstest,t,'InputVariables',{'X' 'Y'},'OutputFormat','uniform') might be a good way to o that.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by