MATLAB Answers

I keep getting the error "Array indices must be positive integers or logical values?"

2 views (last 30 days)
I have been editing a code I found that models a 2 cart system using Euler's Method in an attempt to make it a 3 cart system. However, on line 63 I am recieving an error that states "Array indices must be positive integers or logical values." I am not sure what this means or how to fix it. Any help would be apprecieted. Thanks!


Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 6 Dec 2019
In expressions like this one
MATLAB is trying to index into the variable k2. You need to put in the multiplication sign explicitly:

More Answers (0)


Community Treasure Hunt

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

Start Hunting!