comparison m-toolbox/classes/@ao/fixAxisData.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % Fix up the data type according to the users chosen axis
2 function bs = fixAxisData(bs, pl)
3
4 % Set data
5 for ii =1:numel(bs)
6
7 if (isa(bs(ii).data, 'cdata'))
8 if strfind(pl.find('axis'), 'x')
9 warning('### An AO with cdata doesn''t have a x-axis. Setting the axis to ''y''.');
10 pl.pset('axis', 'y');
11 end
12 else
13 xu = bs(ii).xunits;
14 end
15
16 yu = bs(ii).yunits;
17 switch lower(pl.find('axis'))
18 case 'xy'
19 if bs(ii).data.isprop('x')
20 bs(ii).data = xydata(bs(ii).data.x, bs(ii).data.y);
21 bs(ii).data.setXunits(xu);
22 bs(ii).data.setYunits(yu);
23 else
24 error('### It is not possible to compute on the x-axis of an cdata object.')
25 end
26 case 'x'
27 if bs(ii).data.isprop('x')
28 bs(ii).data = cdata(bs(ii).data.x);
29 bs(ii).data.setYunits(xu);
30 else
31 error('### It is not possible to compute on the x-axis of an cdata object.')
32 end
33 case 'y'
34 bs(ii).data = cdata(bs(ii).data.y);
35 bs(ii).data.setYunits(yu);
36 otherwise
37 error('### shouldn''t happen.');
38 end
39 % Fix the history to what we actually return
40 bs(ii).hist.plistUsed.pset('axis', pl.find('axis'));
41 end
42
43
44 end