Is there any way that indexing(subscript) 0 can be permitted. As these should be positive integer or logicals.

2 views (last 30 days)
-
  1 Comment
DGM
DGM on 25 Nov 2021
There is no zeroth element in a MATLAB array. Since you didn't describe your problem, it's hard to suggest any solution.
If you are trying to extract values "between" or "beyond" the discrete elements of an array, use interpolation tools like interp1() or interp2().
If you're trying to write a loop and you're trying to use a single variable (the loop iterator) for both indexing and numerical operations, don't. Separate that into a vector for numerical operations and then use the loop iterator for indexing.

Sign in to comment.

Accepted Answer

KSSV
KSSV on 25 Nov 2021
Note that a logical is 0 / 1
idx = logical(0)

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!