Index in position 1 exceeds array bounds (must not exceed 2) error using nftool fitnet

1 回表示 (過去 30 日間)
Saikat Sengupta
Saikat Sengupta 2023 年 8 月 28 日
編集済み: Prateekshya 2023 年 9 月 5 日
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 件のコメント
Saikat Sengupta
Saikat Sengupta 2023 年 8 月 31 日
編集済み: Saikat Sengupta 2023 年 8 月 31 日
Hi Dyuman,
Thanks for your answer.I appreciate you help. However, I am running a standard matlab toolbox example. That should not produce this error.
Saikat
Dyuman Joshi
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
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!

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by