-
Notifications
You must be signed in to change notification settings - Fork 4
/
awgseqind.m
executable file
·43 lines (39 loc) · 1.32 KB
/
awgseqind.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
function seqind = awgseqind(pulses,rep)
% seqind = awgseqind(pulses, rep)
% Find the pulse line associated with a pulse group or pulse index.
% negative for groups, positive for pulse index.
% (c) 2010 Hendrik Bluhm. Please see LICENSE and COPYRIGHT information in plssetup.m.
global awgdata;
if isstruct(pulses)
rep=[pulses.rep];
pulses=[pulses.pulses];
elseif ischar(pulses)
pulses = {pulses};
end
seqind = nan(1, length(pulses));
for i = 1:length(pulses)
if iscell(pulses) % could allow ints as well
ind = strmatch(pulses{i}, {awgdata(1).pulsegroups.name}, 'exact');
if isempty(ind) % no such group
seqind(i) = nan;
else
seqind(i) = awgdata(1).pulsegroups(ind).seqind;
end
elseif pulses(i) > 0
if(exist('rep', 'var'))
ind = find(pulses(i) == awgdata(1).seqpulses);
ind=ind(rep(i));
else
ind = find(pulses(i) == awgdata(1).seqpulses, 1);
end
if ~isempty(ind)
seqind(i) = ind;
end
else
seqind(i) = awgdata(1).pulsegroups(-pulses(i)).seqind;
end
end
if any(isnan(seqind))
fprintf('WARNING: Some pulses not present in sequence.\nHit Ctrl-C to abort, or any key to continue.\n');
pause;
end