Logical Indexing Is Gold

Cephas on 17 Nov 2025
Latest activity Reply by Stephen23 on 17 Nov 2025

Instead of looping with if-statements, use logical indexing:
A(A < 0) = 0;
One line, no loops, full clarity.
Stephen23
Stephen23 on 17 Nov 2025
For the given example MAX() will often be more efficient:
A = max(A,0);