error using subsindex

I have a code for rbf neural network but i get error when processing
xdata=[12 25 1 5 ;8 9 21 03 ]
ydata-[2 6 9 8 ;2 8 7 4 ]
training=xdata(:,1:2);test=xdata(:,3:4);
samplesize=size(xdata);
for i=1:3
c=cvpartition(samplesize,'kfold',2)
trainInd=find(training(c,i));
testInd=find(test(c,i));
trainXMat=xdata(xdata(trainInd));
tstXMat=xdata((xdata(testInd)));
trainYMat=ydata(ydata(trainInd));
tstYMat=ydata((ydata(testInd)));
net1=newrbe(xdata,ydata,1.0);
end
is these correct,i get error as
Error using subsindex Function 'subsindex' is not defined for values of class 'cvpartition'.
Error in yasrbf (line 10) trainInd=find(training(c,i));
please help

 採用された回答

Walter Roberson
Walter Roberson 2012 年 4 月 7 日

0 投票

cvpartition() creates a "cvpartition object", not a numeric value, but you are trying to use that object as an index in to the array training() .
Perhaps what you want is
trainInd = find(c.training(i));
or something like that.

4 件のコメント

kash
kash 2012 年 4 月 7 日
thanks walter it works but one thing is
CorrectRate: NaN
ErrorRate: NaN
i inculded
cp = classperf(groups);
cp = classperf(cp, tstYMat, testInd )
please help
Walter Roberson
Walter Roberson 2012 年 4 月 7 日
Sorry, that is outside my experience.
kash
kash 2012 年 4 月 7 日
ok walter thanks for ur suggestion
kash
kash 2012 年 4 月 7 日
another walter in another post
http://www.mathworks.in/matlabcentral/answers/34714-send-request-packet
ur code returns error
please help

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by