-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathScouseTom_debugstring.m
More file actions
54 lines (43 loc) · 1.94 KB
/
ScouseTom_debugstring.m
File metadata and controls
54 lines (43 loc) · 1.94 KB
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 [ dbstring ] = ScouseTom_debugstring( ExpSetup )
% function to create the string sent to arduino for these settings
%useful for debuging in the Serial montior of Arduino or Termite
% Send command 'I' followed by 'A' followed by these lines
dbstring='';
dbstring=[dbstring sprintf('<%d>',ExpSetup.Info.ProtocolLength)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.Elec_num)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.Info.FreqNum)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.Repeats)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.ContactCheckInjectTime)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.Compliance)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.StimulatorTriggerTime)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.StimulatorTriggerOffset)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.StimulatorPulseWidth)];
dbstring=[dbstring sprintf('<%d>',ExpSetup.Info.StimulatorWiperSetting)];
for nn=1:ExpSetup.Info.ProtocolLength
dbstring=[dbstring sprintf('<%d>',ExpSetup.Info.Protocol_Sent(nn,1))];
end
for nn=1:ExpSetup.Info.ProtocolLength
dbstring=[dbstring sprintf('<%d>',ExpSetup.Info.Protocol_Sent(nn,2))];
end
for nn=1:ExpSetup.Info.FreqNum
dbstring=[dbstring sprintf('<%d>',ExpSetup.Freq(nn))];
end
for nn=1:ExpSetup.Info.FreqNum
dbstring=[dbstring sprintf('<%d>',ExpSetup.Amp(nn))];
end
for nn=1:ExpSetup.Info.FreqNum
dbstring=[dbstring sprintf('<%d>',ExpSetup.MeasurementTime(nn))];
end
if ~(isfield(ExpSetup.Info,'Bad_Elec_Sent')) %if the field does not exist
dbstring=[dbstring sprintf('<%d>',0)];
else
if isempty(ExpSetup.Info.Bad_Elec_Sent) % and some bad ones have been enterred
dbstring=[dbstring sprintf('<%d>',0)];
else
dbstring=[dbstring sprintf('<%d>',length(ExpSetup.Info.Bad_Elec_Sent))];
for nn=1:length(ExpSetup.Info.Bad_Elec_Sent)
dbstring=[dbstring sprintf('<%d>',ExpSetup.Info.Bad_Elec_Sent(nn))];
end
end
end
end