EXPORT export an analysis object to a text file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: EXPORT export an analysis object to a text file. CALL: export(a, 'blah.txt'); VERSION: $Id: export.m,v 1.6 2007/10/24 17:35:28 ingo Exp $ HISTORY: 30-03-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = export(a, fname) 0002 % EXPORT export an analysis object to a text file. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: EXPORT export an analysis object to a text file. 0007 % 0008 % CALL: export(a, 'blah.txt'); 0009 % 0010 % VERSION: $Id: export.m,v 1.6 2007/10/24 17:35:28 ingo Exp $ 0011 % 0012 % HISTORY: 30-03-07 M Hewitson 0013 % Creation 0014 % 0015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0016 0017 VERSION = '$Id: export.m,v 1.6 2007/10/24 17:35:28 ingo Exp $'; 0018 0019 %% Check if this is a call for parameters 0020 if nargin == 2 0021 if isa(a, 'ao') && ischar(fname) 0022 in = char(fname); 0023 if strcmp(in, 'Params') 0024 varargout{1} = plist(); 0025 return 0026 elseif strcmp(in, 'Version') 0027 varargout{1} = VERSION; 0028 return 0029 end 0030 end 0031 end 0032 0033 if isa(a, 'ao') 0034 0035 d = a.data; 0036 0037 [x,y] = get_xy_values(a.data); 0038 0039 if isreal(y) 0040 out = [x y]; 0041 else 0042 out = [x real(y) imag(y)]; 0043 end 0044 0045 save(fname, 'out', '-ASCII', '-DOUBLE', '-TABS'); 0046 0047 else 0048 error('### incorrect usage: first argument should be an AO.'); 0049 end 0050 0051 % END 0052