Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Define latlon grid and coordinates (lon follows lat)
- lon_grid = transpose([40.1 40.12 40.14; 40.3 40.32 40.34; 40.5 40.52 40.54]);
- lat_grid = transpose([30 30.2 30.4;30.02 30.22 30.42; 30.04 30.24 30.44]);
- coord = [30.4125 40.4043];
- %% Compute great circle distance
- dist = distance('gc',coord(1),coord(2),lat_grid,lon_grid);
- %% Retrieve index of minimum distance
- [value,array_index] = min(distance(:));
- [i,j] = ind2sub(size(dist),array_index);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement