I am trying to write a code that will grab certain indexes out of an array.
Essentially, I have created an array of 612 indexes, with the first index being January, Feb,through December and so on repeatedly. I now would like to grab only every Jan, Feb, and Dec resulting in 153 indexes into a new array. Here is what I have at the moment. Not achieving what I want but I feel it is close
Any obvious flaws woud be awesome. Thanks for any help
This is Matlab btw
Essentially, I have created an array of 612 indexes, with the first index being January, Feb,through December and so on repeatedly. I now would like to grab only every Jan, Feb, and Dec resulting in 153 indexes into a new array. Here is what I have at the moment. Not achieving what I want but I feel it is close
Code:
mean_winter_global = zeros(153,1);
winter_enso = zeros(153,1);
mean__winter_global(1) = mean_global(1);
mean__winter_global(2) = mean_global(2);
for i = 3:612
for k = 3:153
if mean_global(i)==mean_global(12*k) && i<613
mean_winter_global(k) = mean_global(i);
elseif mean_global(i)==mean_global(13*k) && i<612
mean_winter_global(k) = mean_global(i);
elseif mean_global(i)==mean_global(14*k) && i<611
mean_winter_global(k) = mean_global(i);
end
end
end
Any obvious flaws woud be awesome. Thanks for any help
This is Matlab btw