out of range subscript while training. Error is like sub2ind.

2 views (last 30 days)
I have labelled my folders in a numerical sequential manner. The files in that folders are being used to train my algorithm. The labels have been extracted automatically from the folder names. I think the way matlab reads the folders is different than how i save them in my computer. After the matlab reads the files their order changes. Does it have somthing to do with the error ? The error pops right at training command, "out of range subscript", Error in "sub2ind".

Answers (1)

Sai Pavan
Sai Pavan on 11 Oct 2023
Hi Purvesh,
I understand that you are trying to know whether the order of folders is causing the “out of range subscript” error when using “sub2ind” function.
The order in which MATLAB reads the files from a folder can indeed be different from the order in which they are saved on your computer. This can be due to various factors, such as the operating system's file system or the way MATLAB retrieves file information.
It is unlikely that the "out of range subscript” error is directly related to the file order issue. This error typically occurs when trying to access elements outside the valid range of an array or matrix. You may want to review your code and check for any indexing errors or issues with the dimensions of your data when using the “sub2ind” function.
Please refer to the below documentation to learn more about the “sub2ind” function: https://www.mathworks.com/help/matlab/ref/sub2ind.html
Hope it helps.
Regards,
Sai Pavan

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!