error-Inputs and targets have different numbers of samples.

1 view (last 30 days)
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

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!