view m-toolbox/classes/@tsdata/fixNsecs.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line source

% FIXNSECS fixes the numer of seconds.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: fixes the numer of seconds.
%
% CALL:        d    = fixNsecs(d)
%
% INPUT:       d - tsdata object
%
% OUTPUT:      d - tsdata object
%
% VERSION:     $Id: fixNsecs.m,v 1.4 2011/02/18 16:48:55 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = fixNsecs(varargin)

  obj = varargin{1};

  %%% decide whether we modify the pz-object, or create a new one.
  obj = copy(obj, nargout);

  if isempty(obj.x)
    obj.nsecs = length(obj.y)/obj.fs;
  else
    obj.nsecs = obj.x(end)-obj.x(1) + 1/obj.fs;
  end

  varargout{1} = obj;
end