Have you checked if Nx1 is not already existing before the for loop? It might be that it already exists and that it is a scalar. A hint could be to clear the workspace at the beginning of the code. Anyway, you can trigger "Pause on error" (click on the small arrow under the "Run" button). It will pause the execution right before the error, then launch the code and when it stops, look at the list of variable to check if Nx1 is not just a scalar.
3 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/678443-index-exceeds-the-number-of-array-elements-1-issue#comment_1183328
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/678443-index-exceeds-the-number-of-array-elements-1-issue#comment_1183328
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/678443-index-exceeds-the-number-of-array-elements-1-issue#comment_1183353
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/678443-index-exceeds-the-number-of-array-elements-1-issue#comment_1183353
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/678443-index-exceeds-the-number-of-array-elements-1-issue#comment_1183448
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/678443-index-exceeds-the-number-of-array-elements-1-issue#comment_1183448
Sign in to comment.