forked from qutech/special-measure.pulsecontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plsdefault.m
executable file
·54 lines (43 loc) · 1.46 KB
/
plsdefault.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function pulse = plsdefault(pulse)
% pulse = plsdefault(pulse)
% set defaults and guess format if not given
% (c) 2010 Hendrik Bluhm. Please see LICENSE and COPYRIGHT information in plssetup.m.
global plsdata;
if ~isstruct(pulse) % database indices given
if pulse > length(plsdata.pulses)
error('Requested pulse %d, but only %d are defined. Did you plssync?',pulse,length(plsdata.pulses));
end
pulse = plsdata.pulses(pulse);
return;
% pulse = num2cell(pulse);
% pulse = struct('data', pulse, 'format', 'ind');
end
if ~isfield(pulse, 'xval') %||isempty(pulse.xval) % fails for pulse arrays. Would have to define mask, assign only empty ones
[pulse.xval] = deal([]);
end
if ~isfield(pulse, 'taurc') %|| isempty(pulse.taurc)
[pulse.taurc] = deal(Inf);
end
if ~isfield(pulse, 'name')
[pulse.name] = deal('');
end
if ~isfield(pulse, 'pardef')
[pulse.pardef] = deal([]);
end
if ~isfield(pulse, 'trafofn')
[pulse.trafofn] = deal([]);
end
% only implemented for single pulse
if ~isfield(pulse(1), 'format') || isempty(pulse(1).format)
if isreal(pulse.data)
pulse.format = 'ind';
elseif isfield(pulse.data, 'type')
pulse.format = 'elem';
elseif isfield(pulse.data, 'wf')
pulse.format = 'wf';
elseif isfield(pulse.data, 'pulsetab') || isfield(pulse.data, 'marktab') || isfield(pulse.data, 'pulsefn')
pulse.format = 'tab';
else
error('Invalid format.\n')
end
end