MATLAB: How to solve this problem? with message subscript indices must either be real positive integers

please help me in resolving this error and what is meant by subscript indices?

Hello, I get this error, Subscript indices must either be real positive integers or logicals.
The line with this error is,

Best Answer

  • The index you’re calculating evaluates to 2.0891... so as a float, it definitely does not meet the integer-or-logical criterion.
    I’m not certain what you’re doing with your indices, but one option would be to use the fix function to produce an integer index:
    Other options, if fix does not produce the result you want, are of course are ceil, floor, and round.