-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHPfrd.m
More file actions
23 lines (19 loc) · 709 Bytes
/
HPfrd.m
File metadata and controls
23 lines (19 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function frdout = HPfrd(filein)
% loads ascii data from HP network analyzer and produces FRD object
[head,data] = hdrload(filein);
% split column header
cols = regexp(head(end,:),'"','split');
% find real data column
realcol = find(strcmp(cols,'Data Real'))/2;
% imag
imagcol = find(strcmp(cols,'Data Imag'))/2;
if isempty(realcol)
error('no real data column found')
end
if isempty(imagcol)
error('no imaginary data column found')
end
%frdout = [data(:,1),data(:,realcol)+1i*data(:,imagcol)];
frdout = frd(data(:,realcol)+1i*data(:,imagcol),data(:,1),'FrequencyUnit','Hz');
frdout.Name = ['HP data: ' filein];
end