reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

begend.m (417B)


      1 % begend.m
      2 %	returns the beginning and end of a vector which has missing values
      3 %	together with a 0/1 dummy to indicate if any data is missing in between
      4 
      5 function [beg,fin,anymiss]=begend(y);
      6 
      7 anymiss=0; beg=0;
      8 for i=1:length(y);
      9 	if beg==0; beg=(~isnan(y(i)))*i;
     10 	else;  
     11 		if anymiss==0; anymiss=isnan(y(i))*i; end;
     12 		if ~isnan(y(i)); fin=i; end;
     13 	end;
     14 end;	  
     15 if isempty(fin); fin=0; end;
     16 anymiss=(anymiss<fin);
     17