-
Notifications
You must be signed in to change notification settings - Fork 2
/
bp.m
35 lines (28 loc) · 757 Bytes
/
bp.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 bp
ai = init();
filename = 'data.csv';
i = 0;
last_sample = 0
out = daqmem
while 1 > 0
if ai.SamplesAcquired - last_sample > 260
data = peekdata(ai, 256);
csvwrite(filename, data);
fclose('all');
i = i + 1;
strcat('Samples Acq: ',num2str(ai.SamplesAcquired))
strcat('Sample nr: ', num2str(i))
last_sample = ai.SamplesAcquired;
end
end
stop(ai);
end
function ai = init
info = getDaqDevice('gmlplusdaq');
ai = analoginput(info.AdaptorName, info.comport);
addchannel(ai, 1);
addchannel(ai, 2);
set(ai,'SamplesPerTrigger', Inf);
daqmem(ai, 640000);
start(ai);
end