Index exceeds the number of array elements

Coding details:-
Sample : 3x89 double
target_sample : 1x89 double
output : 1x209 double (training data)
output1 : 1x89 double (testing data)
My coding as follow:-
output1 =sim(net,sample);
r=corr2(output1,target_sample);
y=r;
[m,b,r]=postreg(target_sample,output1);
for n=1:size(output,2)
err(n)=[target_sample(n)-output1(n)].^2;
abs_error(n)=abs(target_sample(n)-output1(n));
end
rms_err=sqrt(sum(err,2)./101);
Command window shows error "Index exceeds the number of array elements (89)." how can i fix this?

 Accepted Answer

It seems like this:
for n=1:size(output,2)
should be this:
for n=1:size(output1,2)

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Asked:

on 18 Dec 2021

Commented:

on 18 Dec 2021

Community Treasure Hunt

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

Start Hunting!