Home > classes > @ao > export.m

export

PURPOSE ^

EXPORT an analysis object to a text file.

SYNOPSIS ^

function export(a, fname)

DESCRIPTION ^

 EXPORT an analysis object to a text file.
 
 usage: export(a, 'blah.txt');
 
 M Hewitson 30-03-07
 
 $Id: export.html,v 1.1 2007/06/08 14:15:02 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function export(a, fname)
0002 
0003 % EXPORT an analysis object to a text file.
0004 %
0005 % usage: export(a, 'blah.txt');
0006 %
0007 % M Hewitson 30-03-07
0008 %
0009 % $Id: export.html,v 1.1 2007/06/08 14:15:02 hewitson Exp $
0010 %
0011 
0012 if isa(a, 'ao')
0013   
0014   d = a.data;
0015   if isa(d, 'cdata')
0016     
0017     vals = get(d, 'vals');
0018     n    = 1:length(vals);
0019     out = [n vals];
0020     save(fname, 'out', '-ASCII', '-DOUBLE', '-TABS');
0021     
0022   elseif isa(d, 'fsdata')
0023     
0024     xx = get(d, 'xx');
0025     f  = get(d, 'f');  
0026     if isreal(xx)
0027       out = [f xx];
0028     else
0029       out = [f real(xx) imag(xx)];
0030     end
0031     save(fname, 'out', '-ASCII', '-DOUBLE', '-TABS');
0032     
0033   elseif isa(d, 'tsdata')
0034     
0035     x  = get(d, 'x');
0036     t  = get(d, 't');  
0037     out = [t x];
0038     save(fname, 'out', '-ASCII', '-DOUBLE', '-TABS');
0039     
0040   else
0041     error('### unknown AO data type.');
0042   end
0043   
0044 else
0045   error('### incorrect usage: first argument should be an AO.');
0046 end
0047 
0048 
0049 
0050 % END

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003