Logical Indexing Is Gold
Instead of looping with if-statements, use logical indexing:
A(A < 0) = 0;
One line, no loops, full clarity.
1 Comment
Time DescendingFor the given example MAX() will often be more efficient:
A = max(A,0);
Sign in to participate