Hi all, I'm looking for a clever way to optimize the following chunk of code. The function is to get a grid of lat, lon coordinates using the reference matrix R, and the indices of Z.
However, with such huge dimensions, this nested for loop is painfully slow! How can I avoid for loops in this case?
[Z, R] = arcgridread('biloxi_ms.asc');tempLAT=zeros(9721,10801);tempLON=zeros(9721,10801);for i =1:9721 for j = 1:10801 [tempLAT(i,j), tempLON(i,j)] = setltln(Z, R, i, j); endend
Best, Rob
Best Answer