forked from qutech/special-measure.pulsecontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdload.m
executable file
·34 lines (26 loc) · 917 Bytes
/
pdload.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function pd = pdload(name, opts)
%function pd = pdload(name, opts)
% Load most recent entry in a pulse dictionary. Load the entire
% dictionary if opts='all'
% if opts is a number, load the most recent dictionary before that.
% l.29: changed < to <=, FIX ME MAYBE? 2014_04_03 Tim and Pascal
% (c) 2010 Hendrik Bluhm. Please see LICENSE and COPYRIGHT information in plssetup.m.
global plsdata;
if isstruct(name) % This allows pdload(pload('x')) to be equiv to pdload('x')
pd=name;
return;
end
if ~exist('opts','var')
opts = '';
end
if isempty(strfind(opts,'all')) && (isempty(opts) || ~isnumeric(opts))
load([plsdata.grpdir, 'pd_', name,'_last']);
else
load([plsdata.grpdir, 'pd_', name]);
if isnumeric(opts) && ~isempty(opts)
times=cellfun(@(x) getfield(x,'time'),pd);
i=find(times <= opts,1,'last');
pd=pd{i};
end
end
return