-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrite_parameter_file.m
68 lines (62 loc) · 2.54 KB
/
write_parameter_file.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
function output_file = write_parameter_file(filename, base_name, groups, Fs, num_channels, t, num_features, voltage_range)
%--------------------------------------------------------------------------
% write_parameter_file.m -
%
% Usage: write_parameter_file();
%
% Input:
% Output:
%
% Written by Marshall Crumiller
%--------------------------------------------------------------------------
output_file = sprintf('%s.xml', base_name);
if(output_file==-1), return; end
f = fopen(output_file,'w');
% get necessary data
%[OpenedFileName, Version, Freq, Comment, Trodalness, NPW, PreTresh, ...
% SpikePeakV, SpikeADResBits, SlowPeakV, SlowADResBits, Duration, ...
% DateTime] = plx_information(filename); %#ok<NASGU,ASGLU>
gain=1;
fprintf(f,'<parameters>\r\n');
fprintf(f,' <acquisitionSystem>\r\n');
fprintf(f,' <nBits>16</nBits>\r\n');
fprintf(f,' <nChannels>%g</nChannels>\r\n',num_channels);
fprintf(f,' <samplingRate>%g</samplingRate>\r\n',Fs);
fprintf(f,' <voltageRange>%g</voltageRange>\r\n', voltage_range); % I think this is the range of data
fprintf(f,' <amplification>%g</amplification>\r\n',gain); % what if it's different for each channel?
fprintf(f,' <offset>0</offset>\r\n');
fprintf(f,' </acquisitionSystem>\r\n');
%fprintf(f,' <fieldPotentials>\r\n');
%fprintf(f,' <lfpSamplingRate>1250</lfpSamplingRate>\r\n'); % not sure about this one--do we have LFP?
%fprintf(f,' </fieldPotentials>\r\n');
fprintf(f,' <anatomicalDescription>\r\n');
fprintf(f,' <channelGroups>\r\n');
for i = 1:length(groups)
group=groups{i};
fprintf(f,' <group>\r\n');
for j = 1:length(group)
fprintf(f,' <channel>%g</channel>\r\n',group(j));
end
fprintf(f,' </group>\r\n');
end
fprintf(f,' </channelGroups>\r\n');
fprintf(f,' </anatomicalDescription>\r\n');
fprintf(f,' <spikeDetection>\r\n');
fprintf(f,' <channelGroups>\r\n');
for i = 1:length(groups)
group = groups{i};
fprintf(f,' <group>\r\n');
fprintf(f,' <channels>\r\n');
for j = 1:length(group)
fprintf(f,' <channel>%g</channel>\r\n',group(j));
end
fprintf(f,' </channels>\r\n');
fprintf(f,' <nSamples>%g</nSamples>\r\n', length(t)); % points per sample waveform
fprintf(f,' <peakSampleIndex>%g</peakSampleIndex>\r\n',find(t==0));
fprintf(f,' <nFeatures>%g</nFeatures>\r\n',num_features); % num features
fprintf(f,' </group>\r\n');
end
fprintf(f,' </channelGroups>\r\n');
fprintf(f,' </spikeDetection>\r\n');
fprintf(f,'</parameters>');
fclose(f);