view m-toolbox/classes/@tsdata/collapseX.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents f0afece42f48
children
line wrap: on
line source

% COLLAPSEX Checks whether the x vector is evenly sampled and then removes it
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: Checks whether the x vector is evenly sampled and then removes
%              it after setting the t0 field.
%
% CALL:        obj = collapseX(obj)
%
% INPUT:       obj - tsdata object
%
% OUTPUT:      obj - tsdata object
%
% VERSION:     $Id: collapseX.m,v 1.9 2011/06/30 16:24:12 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = collapseX(varargin)

  obj = varargin{1};

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

  if ~isempty(obj.x)
    [fs, t0, uneven] = tsdata.fitfs(obj.x);
    if uneven
      obj.fs = fs;
    else
      % adjust T0
      obj.toffset = obj.toffset + obj.x(1)*1e3;
      % adjust Nsecs
      obj.nsecs = length(obj.y)/obj.fs;
      % remove X samples
      obj.x  = [];
    end
  end

  varargout{1} = obj;
end