error-Inputs and targets have different numbers of samples.

1 次查看(过去 30 天)
I have a code
P1 = [-1 -1 2 2; 0.3 5.3 0.3 5.4]; Tar = [0 ;1 ]
indices=crossvalind('kfold',Tar,10); for i=1:10 test=(indices==i);trains= ~test tst = (indices==i); val = (indices== mod(i+1,10)); trn = ~[tst,val]; net=newff(P1(:,trains),Tar(trains),1); net=init(net);
[net,tr]=train(net,P1(:,trains),Tar(trains));
out = round(sim(net,P1(:,test)));
end
I get error a s
Error using trainlm (line 109) Inputs and targets have different numbers of samples.
Error in cfour (line 60) [net,tr]=train(net,P1(:,trains),Tar(trains));
please help

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by