vec, ~] = ymd(t);
0045 
0046 <span class="keyword">if</span> strcmp(option,<span class="string">'delete'</span>)
0047     <span class="comment">% option 1 - delete values outside subperiod</span>
0048     t_sub = t(ismember(month_vec,subperiod));
0049     X_sub = X(ismember(month_vec,subperiod));
0050 <span class="keyword">elseif</span> strcmp(option,<span class="string">'nan'</span>)
0051     <span class="comment">% option 2 - assign NaN to values outside subperiod</span>
0052     t_sub = t;
0053     X_sub