Why do I receive an error when using the TREETEST function within the Statistics Toolbox?

1 回表示 (過去 30 日間)
When I run the following code:
XX = rand(1e3,5);
YY = ( (XX(:,2) > 0.5) & (XX(:,4) < 0.5) );
TT = treefit(XX,YY,'method','classification','splitmin',50);
[COST,SECOST,NTNODES,BESTLEVEL] = TREETEST(TT,'cross',XX,YY);
I receive the following error message:
??? cellfun works only on cells.

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
This enhancement has been incorporated in MATLAB 7.6 (R2008a). For previous product releases, read below for any possible workarounds:
This error occurs when the fourth input argument to TREETEST is logical rather than double. Any logical value or matrix of values can be converted to double using DOUBLE. This issue can be remedied by using:
YY = double(YY);
[COST,SECOST,NTNODES,BESTLEVEL] = TREETEST(TT,'cross',XX,YY);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

製品


リリース

R13SP1

Community Treasure Hunt

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

Start Hunting!

Translated by