MATLAB Answers

MATLAB coder Error evaluating test code Caused by: Index exceeds matrix dimentions

4 views (last 30 days)

Accepted Answer

Walter Roberson
Walter Roberson on 22 May 2018
Edited: Walter Roberson on 22 May 2018
is not guaranteed to have exactly the same number of elements in generated code.
Why are you doing "for comp=1:s; end" without any code in there? Why are you "if dx>Xstep(NR)" after that with no code inside the "if" ?
Your code generates index out of range even in MATLAB.
Your dx is greater than any Xstep() value. It is not surprising that you go past the end of the array.
  1 Comment
Martin Andersson
Martin Andersson on 22 May 2018
Hi I simplyfied the code to just show the error (and have now also change the Xstep so it runs i MATLAB, but I still get the same error in MATLAB Coder)

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!