


EXPORT export an analysis object to a text file.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: EXPORT export an analysis object to a text file.
CALL: export(a, 'blah.txt');
export(a, plist);
M-FILE INFO: Get information about this methods by calling
>> ao.getInfo('export')
Get information about a specified set-plist by calling:
>> ao.getInfo('export', 'None')
VERSION: $Id: export.m,v 1.12 2008/08/08 12:29:16 hewitson Exp $
HISTORY: 30-03-07 M Hewitson
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


0001 % EXPORT export an analysis object to a text file. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: EXPORT export an analysis object to a text file. 0005 % 0006 % CALL: export(a, 'blah.txt'); 0007 % export(a, plist); 0008 % 0009 % M-FILE INFO: Get information about this methods by calling 0010 % >> ao.getInfo('export') 0011 % 0012 % Get information about a specified set-plist by calling: 0013 % >> ao.getInfo('export', 'None') 0014 % 0015 % VERSION: $Id: export.m,v 1.12 2008/08/08 12:29:16 hewitson Exp $ 0016 % 0017 % HISTORY: 30-03-07 M Hewitson 0018 % Creation 0019 % 0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0021 0022 function varargout = export(varargin) 0023 0024 % Check if this is a call for parameters 0025 if utils.helper.isinfocall(varargin{:}) 0026 varargout{1} = getInfo(varargin{3}); 0027 return 0028 end 0029 0030 import utils.const.* 0031 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0032 0033 % Collect input variable names 0034 in_names = cell(size(varargin)); 0035 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0036 0037 % Collect all AOs 0038 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0039 [pl, pl_invars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names); 0040 0041 % Combine plists 0042 pl = combine(pl, getDefaultPlist); 0043 0044 % get filename from plist 0045 filename = find(pl, 'filename'); 0046 if isempty(filename) 0047 for j=1:numel(rest) 0048 if ischar(rest{jj}) 0049 filename = rest{jj}; 0050 break 0051 end 0052 end 0053 end 0054 if isempty(filename) 0055 error('### You must specify a filename. Either directly, or in a plist'); 0056 end 0057 0058 if length(as) > 1 0059 error('### Export can only deal with one AO at a time.'); 0060 end 0061 0062 if isreal(as.data.y) 0063 out = [as.data.x as.data.y]; 0064 else 0065 out = [as.data.x real(as.data.y) imag(as.data.y)]; 0066 end 0067 0068 save(filename, 'out', '-ASCII', '-DOUBLE', '-TABS'); 0069 0070 end 0071 0072 %-------------------------------------------------------------------------- 0073 % Get Info Object 0074 %-------------------------------------------------------------------------- 0075 function ii = getInfo(varargin) 0076 if nargin == 1 && strcmpi(varargin{1}, 'None') 0077 sets = {}; 0078 pl = []; 0079 else 0080 sets = {'Default'}; 0081 pl = getDefaultPlist; 0082 end 0083 % Build info object 0084 ii = minfo(mfilename, 'ao', '', 'Output', '$Id: export.m,v 1.12 2008/08/08 12:29:16 hewitson Exp $', sets, pl); 0085 end 0086 0087 %-------------------------------------------------------------------------- 0088 % Get Default Plist 0089 %-------------------------------------------------------------------------- 0090 function pl_default = getDefaultPlist() 0091 pl_default = plist('filename', ''); 0092 end 0093 0094