how to select the desired range of each dimension from the 3d array?

4 views (last 30 days)
Hello all,
I have 3d double array (precipitation=1439*719*1512) that is:
latitude=1439
longitude=719
time=1512
now I want to select a range from each dimension and build a new array named new_precipitation like this:
latitude range = 1400 to 1439
longitude range = 500-519
time= 700-900
in fact, new_precipitation is 3d array with the size of 39*19*200
how to do this? please help me with this issue.
Best Regards

Accepted Answer

Adam
Adam on 8 Oct 2019
Edited: Adam on 8 Oct 2019
new_precipitation = precipitation( 1400:1439, 500:519, 700:900 )
would create what you ask for though it will be 1 bigger in each dimension than you say it should be - 40x20x201.
If your final size is fixed you need to reduce each range by 1 at either end.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!