I have a matrix of size 97x97x117 (called yearly_array2). I'm trying to extract specific portions of the 3rd dimension (i.e. positions 7, 10, 34, 52, 79, 82, 88, 94, 100, & 115) and place those in a brand new matrix (called SLP_top_10). The expected size of the new matrix should be 1440x721x10. When I run the loop in my code, each iteration of "i" gets replaced by the next, and I'm left with the last postion (when i = 115) in the new matrix, when instead I want all 10 postions within my new matrix. What can I do, or how should I modify the following code, to retain all 10 positions of interest in my new array?
SLP_top_10 = zeros(97,97,10);
for i = [7 10 34 52 79 82 88 94 100 115]
SLP_top_10 = yearly_array2(:,:,i);