Logical Indexing Is Gold

Cephas am 17 Nov. 2025
Letzte Aktivität Antwort von Stephen23 am 17 Nov. 2025

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