Logical indexing

IDSTAT-28
TitleUse logical indexing instead of linear or subscript indexing where possible.
PriorityStrongly recommended
Severity level6
DescriptionTo speed up your code, use logical indexing instead of linear or subscript indexing where possible.
RationaleLogical indexing is faster and more readable.

Avoid:

index = intersect(find(v > MIN), find(v < MAX));

Instead use:

index = (v > MIN) & (v < MAX);