view m-toolbox/test/test_ao_scatterData.m @ 30:317b5f447f3e database-connection-manager

Update workspaceBrowser
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% Test ao/scatterData for:
% - functionality
%
% M Hueller 21-04-10
%
% $Id: test_ao_scatterData.m,v 1.1 2010/04/21 04:36:00 mauro Exp $
%
function test_ao_scatterData()
  
  %
  % build the output object
  a1 = ao(plist('type', 'tsdata', ...
    'xvals', [1:10]', 'dx', 0.1*ones(10, 1), ...
    'yvals', [2:2:20]', 'dy', 0.2*ones(10, 1), ...
    'xunits', 's', 'yunits', 'K' ...
    ));
  
  a2 = ao(plist('type', 'tsdata', ...
    'xvals', [1:10]', 'dx', 0.1*ones(10, 1), ...
    'yvals', exp([.1:.1:1])', 'dy', 0.01*ones(10, 1), ...
    'xunits', 's', 'yunits', 'Pa' ...
    ));
  
  pl = plist;
  
  % build the output object
  b = scatterData(a1, a2, pl)
  
  % check that the output is a xydata object
  if ~isa(b.data, 'xydata')
    error('### Wrong output object class');
  end
  
  % check that the x values are correct
  if ~isequal(b.x, a1.y)
    error('### Wrong output x values');
  end
  % check that the dx values are correct
  if ~isequal(b.dx, a1.dy)
    error('### Wrong output dx values');
  end
  % check that the xunits are correct
  if ~isequal(b.xunits, a1.yunits)
    error('### Wrong output x units');
  end
  
  % check that the y values are correct
  if ~isequal(b.y, a2.y)
    error('### Wrong output y values');
  end
  % check that the dy values are correct
  if ~isequal(b.dy, a2.dy)
    error('### Wrong output dy values');
  end
  % check that the xunits are correct
  if ~isequal(b.yunits, a2.yunits)
    error('### Wrong output y units');
  end
end