Index in position 1 exceeds array bounds (must not exceed 2) error using nftool fitnet
2 views (last 30 days)
Show older comments
Hello,
I am trying to run the nftool examples and I am getting an error 'Index in position 1 exceeds array bounds (must not exceed 2).' when using the nftool example data. The screen shots show the errors when using the abaloneinputs/targets data set .
Using fitnet from the commandline with the same data also gives the error. I would appreciate any help to figure out what is going wrong here.


thank you
Saikat Sengupta.
3 Comments
Dyuman Joshi
on 31 Aug 2023
"However, I am running a standard matlab toolbox example."
Idk how that is related to the error obtained.
"That should not produce this error."
What makes you think so?
Answers (1)
Prateekshya
on 5 Sep 2023
Edited: Prateekshya
on 5 Sep 2023
Hi Saikat,
As per my understanding, you are getting an "index exceeds array bounds" error at line 176 which is:
range(inputStart(j):inputStop(j),:) = temp2((inputStart(j)-inputStop(j))-inputStart(j)+1,:);
It seems there is some issue in the indexing and not the standard toolbox example. One way to debug the above line is to print the variables individually with the corresponding indices to see which of them is causing the error. You may try adding something as mentioned below before line 176. The final code will be:
inputStart(j)
inputStop(j)
(inputStart(j):inputStop(j))-inputStart(j)
range(inputStart(j):inputStop(j),:) = temp2((inputStart(j)-inputStop(j))-inputStart(j)+1,:);
If any of the above statements cause the same error, you should make necessary changes to the indices in order to avoid the error. If the above statements are working fine, then try adding these statements further:
% inputStart(j)
% inputStop(j)
% (inputStart(j):inputStop(j))-inputStart(j)[DJ1] [DJ2]
range(inputStart(j):inputStop(j),:)
temp2((inputStart(j)-inputStop(j))-inputStart(j)+1,:)
range(inputStart(j):inputStop(j),:) = temp2((inputStart(j)-inputStop(j))-inputStart(j)+1,:);
You may or may not comment out the first three lines. By following this process, you will be able to figure out for which variable the index is exceeding the bounds which will help you in avoiding the error.
Hope this helps!
0 Comments
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!