question regarding dividing squares figure into multiple square figures in matlab

1 view (last 30 days)
I have a 30 X 30 bounding box with maximum and minimum latitude and longitude. Let it be denoted as (latMin,lonMin) and (latMax,lonMax). I would like to divide this bounding box into 16 squares and extract the latitude and longitude for each square. For 4 squares I can simply do the following: centLon = (minLon + maxLon)/2.0; centLat = (minLat + maxLat)/2.0;
and the four boxes that I get will be: bbox0 = (minLon, centLon, minLat, centLat); bbox1 = (centLon, maxLon, minLat, centLat); bbox2 = (minLon, centLon, centLat, maxLat); bbox3 = (centLon, maxLon, centLat, maxLat);
but this would be tedious for 16 boxes. Is there a better way?

Answers (1)

Walter Roberson
Walter Roberson on 13 Jun 2015
divisions = 4;
LAT = linspace(latMin, latMax,divisions+1);
LONG = linspace(longMin, longMax,divisions+1);
Bonding box (J,K) runs from LAT(J) to LAT(J+1), LONG(K) to LONG(K+1)

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!