-
Notifications
You must be signed in to change notification settings - Fork 4
/
awgrm.m
executable file
·49 lines (41 loc) · 1.47 KB
/
awgrm.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
function awgrm(grp, ctrl)
% awgrm(grp, ctrl)
% grp: 'all' or group name
% ctrl: 'after' remove all following groups
% (otherwise, specified group is removed by removing it and following ones
% and then reloading the latter.
% (c) 2010 Hendrik Bluhm. Please see LICENSE and COPYRIGHT information in plssetup.m.
global awgdata;
if strcmp(grp, 'all')
awgcntrl('stop');
for a=1:length(awgdata)
fprintf(awgdata(a).awg, 'SEQ:LENG 0');
awgdata(a).pulsegroups = [];
awgdata(a).seqpulses = [];
end
awgsavedata;
return;
end
grp = awggrpind(grp); %strmatch(grp, strvcat(awgdata.pulsegroups.name), 'exact');
grp(2:end) = [];
if isnan(grp)
return;
end
awgcntrl('stop');
if exist('ctrl','var') && strfind(ctrl, 'after')
for a=1:length(awgdata)
fprintf(awgdata(a).awg, 'SEQ:LENG %d', awgdata(a).pulsegroups(grp).seqind-1 + sum(awgdata(a).pulsegroups(grp).nline));
awgdata(a).seqpulses(awgdata(a).pulsegroups(grp).seqind + sum(awgdata(a).pulsegroups(grp).npulse):end) = [];
awgdata(a).pulsegroups(grp+1:end) = [];
end
% may miss trigger line.
return;
end
for a=1:length(awgdata)
fprintf(awgdata(a).awg, 'SEQ:LENG %d', awgdata(a).pulsegroups(grp).seqind-1);
awgdata(a).seqpulses(awgdata(a).pulsegroups(grp).seqind:end) = [];
groups = {awgdata(a).pulsegroups(grp+1:end).name};
awgdata(a).pulsegroups(grp:end) = [];
end
% log unloading here if necessary
awgadd(groups);