tabulate() is not working properly

10 ビュー (過去 30 日間)
Binzi Shu
Binzi Shu 2016 年 3 月 2 日
回答済み: Kafayat Olayinka 2020 年 2 月 29 日
I have a table and I try to tabulate a column of the table, say the name of the column is "price". This column has values of 0,30,60 and 90. And I want to see the frequency counts. But when I say "tabulate(table.price)" it will return an error "Undefined function 'tabulate' for input arguments of type 'single'". This also happens for other data types, for example "Undefined function 'tabulate' for input arguments of type 'int8'", Undefined function 'tabulate' for input arguments of type 'categorical'", etc.. What is the type that tabulate() can work on and how can I solve this problem? Thanks.

回答 (2 件)

Kevin Claytor
Kevin Claytor 2016 年 3 月 2 日
It sounds like you don't have the tabulate function. This is included with the stats + machine learining toolbox. Can you paste the output of the "ver" command into a reply?
If you just want the histogram counts, consider:
[counts, centers] = hist(table.variablename)
  2 件のコメント
Binzi Shu
Binzi Shu 2016 年 3 月 2 日
Yes I have it. I did try "ver" and I saw the name of this stats+machine toolbox....
Kevin Claytor
Kevin Claytor 2016 年 3 月 3 日
In that case, you may be over-riding it with another function or variable. Can you stop your code right before the error (eg; with a breakpoint) and copy the output from:
>> which tabulate
and
>> whos tabulate

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


Kafayat Olayinka
Kafayat Olayinka 2020 年 2 月 29 日
price=[0,30,30,60,60,90];
tab=tabulate(price);
output for tab:
price count %
0 1.0000 16.6667
30.0000 2.0000 33.3333
60.0000 2.0000 33.3333
90.0000 1.0000 16.6667
plot(tab(:,1),tab(:,2));

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by