Replacing for loops with matrix math.
7 views (last 30 days)
Matt J on 12 Oct 2018
Edited: Matt J on 12 Oct 2018
I wouldn't say that replacing the loops with matrix operations is a way to "simplify" it, but here's how you could do it.
keep= J>=I & J<=num_pts-I;
diag(keep) = testm1(J,2) .* testm2(J+I,2);