Index in position 1 exceeds array bounds (must not exceed 2) error using nftool fitnet
1 回表示 (過去 30 日間)
古いコメントを表示
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1466926/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1466931/image.png)
thank you
Saikat Sengupta.
3 件のコメント
Dyuman Joshi
2023 年 8 月 31 日
"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?
回答 (1 件)
Prateekshya
2023 年 9 月 5 日
編集済み: Prateekshya
2023 年 9 月 5 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!