/SEMS/@helicorder/private/SST/delete_sst.m

http://seismic-event-matlab-suite.googlecode.com/ · MATLAB · 56 lines · 36 code · 7 blank · 13 comment · 13 complexity · bd50b17c0631ba9b54b8eff83a43183a MD5 · raw file

  1. function sst = delete_sst(sst,t1,t2,varargin)
  2. %DELETE_SST:
  3. %
  4. %USAGE: sst = delete_sst(sst,t1,t2)
  5. % sst = delete_sst(sst,t1,t2,method)
  6. %
  7. %INPUTS: sst -->
  8. % t1 -->
  9. % t2 -->
  10. % method -->
  11. %
  12. %OUTPUTS: sst
  13. method = 0; % default method: 'split'
  14. if nargin < 3
  15. error('DELETE_SST: Too few input arguments')
  16. elseif nargin > 4
  17. error('DELETE_SST: Too many input arguments')
  18. elseif nargin == 4
  19. switch lower(varargin{1})
  20. case 'full'
  21. method = 1; % merge new sst
  22. case 'part'
  23. method = 2; % merge new sst
  24. end
  25. end
  26. %% EVERYTHING BELOW THIS LINE BELONGS TO EXTRACT_SST AND HAS NOT YET BEEN
  27. %% MODIFIED FOR DELETE_SST
  28. [N1 P1] = search_sst(t1,sst);
  29. [N2 P2] = search_sst(t2,sst);
  30. if P1 == 1
  31. if method == 0
  32. first = [t1 sst(N1,2)];
  33. elseif method == 1
  34. first = [];
  35. end
  36. elseif P1 == 0
  37. first = sst(N1,:);
  38. end
  39. if P2 == 1
  40. if method == 0
  41. last = [sst(N2,1) t2];
  42. elseif method == 1
  43. last = [];
  44. end
  45. elseif P2 == 0
  46. last = sst(N2-1,:);
  47. N2 = N2-1;
  48. end
  49. sub_sst = [first; sst(N1+1:N2-1,:); last];