0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % FIL a wrapper for the LISO fil executable.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: FIL a wrapper for the LISO fil executable.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % CALL: utils.bin.fil('foo.fil')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % utils.bin.fil('foo.fil', 'foo2.fil', 'foo3.fil', ...)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % utils.bin.fil('foo.fil', 'foo2.fil', 'foo3.fil', '-c', ...)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % >> a = utils.bin.fil('foo.fil') % get result as AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % >> f = utils.bin.fil('foo_iir.fil') % get result as MIIR
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % >> utils.bin.fil % get fil help
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % INPUTS:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % 'filename' - one or more .fil filenames
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % 'option' - pass options to fil
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 % VERSION: $Id: fil.m,v 1.6 2011/03/24 19:57:39 ingo Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 % HISTORY: 07-10-08 M Hewitson
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % Creation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 function varargout = fil(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % Get my location
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 p = mfilename('fullpath');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 p = p(1:end-length(mfilename));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 switch computer
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 case 'MACI'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 LISO = fullfile(p, 'liso/maci');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % Point to fil binary
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 FIL = ['LISO_DIR="' LISO '" ' fullfile(LISO, 'fil')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 case 'PCWIN'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 LISO = fullfile(p, 'liso/win32');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % Point to fil binary
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 FIL = ['LISO_DIR="' LISO '" ' fullfile(LISO, 'fil.exe')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 error('### I do not have a binary for LISO on %s', computer)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 if nargin == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 system(FIL);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 % Loop for any options first
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 opts = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 for jj=1:nargin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 if ischar(varargin{jj})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 if varargin{jj}(1) == '-'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 opts = [opts ' -n ' varargin{jj}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 % Now loop over input files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 outs = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 for jj=1:nargin
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 if ischar(varargin{jj})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % is this a filename or an option?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 if varargin{jj}(1) ~= '-'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 % Check the file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 filename = varargin{jj};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 [path, name, ext] = fileparts(filename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 if ~strcmp(ext, '.fil')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 error('### The input filename does not appear to be a fil file. [%s]', filename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 % run FIL
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 cmd = [FIL ' ' opts ' ' filename];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 disp(['*** running: ' cmd]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 [status, result] = system(cmd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 disp(result)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 if status
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 % try to load the output file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 outfile = fullfile('.', path, [name '.out']);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 if exist(outfile, 'file')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 % What type of LISO output do we get here?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 min = textread(filename,'%s');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 % look for keywords in file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 tfoutput = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 iir = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 fit = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 if any(strcmp('tfoutput', min)), tfoutput = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 if any(strcmp('iir', min)), iir = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 if any(strcmp('fit', min)), fit = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 if iir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 % we have an IIR filter so we load that instead of the .out
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 % file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 filt = miir(filename);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 if ~isempty(filt.a)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 if nargout == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 iplot(resp(filt));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 outs = [outs {filt}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 elseif fit || tfoutput
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 % load data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 fid = fopen(outfile, 'r');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 % Look for the first line of data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 comment_char = '#';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 while ~feof(fid)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 f = strtrim(fgetl(fid));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 if ~isempty(f)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 if f(1) ~= comment_char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 break;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 % Scan it to find how many columns we have in the file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 c = regexp(f, ' +', 'split');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 nc = numel(c);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 scanformat = repmat('%f ', 1, nc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 % rewind file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 fseek(fid, 0, 'bof');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 % Read all data
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 din = textscan(fid, scanformat, 'CommentStyle', comment_char, 'CollectOutput', 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 % close file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 fclose(fid);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 % did we get data?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 if ~isempty(din{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 din = din{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 if tfoutput
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 % what kind of columns do we have?
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 dbdeg = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 reim = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 absdeg = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 if any(strcmp('db:deg', min)), dbdeg = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 if any(strcmp('re:im', min)), reim = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 if any(strcmp('abs:deg', min)), absdeg = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 if dbdeg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 disp('-- TF is in db:deg');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 amp = 10.^(din(:,2)/20) .* exp(1i*din(:,3)*pi/180);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 elseif reim
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 disp('-- TF is in re:im');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 amp = complex(din(:,2), din(:,3));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 elseif absdeg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 disp('-- TF is in abs:deg');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 amp = din(:,2) .* exp(1i*din(:,3)*pi/180);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 error('### unknown data format. I only understand: abs:deg, db:deg, re:im, at the moment');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 % we need to look for nout:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 dbdeg = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 reim = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 absdeg = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 abs = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 db = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 re = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164 im = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 if any(strcmp('nout:db:deg', min)), dbdeg = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 if any(strcmp('nout:re:im', min)), reim = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 if any(strcmp('nout:abs:deg', min)), absdeg = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 if any(strcmp('db', min)), db = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 if any(strcmp('re', min)), re = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 if any(strcmp('im', min)), im = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 if any(strcmp('abs', min)), abs = true; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 if dbdeg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 amp = 10.^(din(:,2)./20) .* exp(1i*din(:,3)*pi/180);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 disp('-- Fit is in db:deg');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 elseif reim
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 amp = complex(din(:,2), din(:,3));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 disp('-- Fit is in re:im');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 elseif absdeg
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 amp = din(:,2) .* exp(1i*din(:,3)*pi/180);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 disp('-- Fit is in abs:deg');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 elseif abs || re || im
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 amp = din(:,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 elseif db
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 amp = 10.^(din(:,2)/20);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 error('### unknown data format. I only understand: abs:deg, db:deg, re:im, at the moment');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 % build output AO
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 a = ao(din(:,1), amp);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 a.setName(name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 a.setXunits('Hz');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 outs = [outs {a}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 warning('### unknown output type');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 end % End switch over output type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 end % If output file exists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 end % If command suceeded
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 end % If is a fil file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 end % char argument
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 end % loop over args
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 if nargout == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 % do nothing
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 elseif nargout == numel(outs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 varargout{:} = outs{:};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 elseif nargout == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 allSame = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 for jj=2:numel(outs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 if ~strcmp(class(outs{1}), class(outs{jj}))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 allSame = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 if allSame
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 varargout{1} = [outs{:}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 varargout{1} = outs;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 error('### Unknown outputs');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226
|