源文件名爲「ReadOutputFile.m」。這是什麼語言?
function ReadOutputFile(inputFile, outputFile)
SPIT = 2;
R_REGULARITY = 8;
%read input, threshold, and level
spitclip = wavread(inputFile);
spitclip = spitclip*(2^15);
fid = fopen('threshBinary.bin', 'rb', 'native');
thresh = fread(fid, 'int16');
fclose(fid);
fid = fopen('signalLevelBinary.bin', 'rb', 'native');
lvl = fread(fid, 'int16');
fclose(fid);
%get start and stop information from output file
outputNumeric = csvread(outputFile);
starts = outputNumeric(:,1);
stops = outputNumeric(:,2);
types = outputNumeric(:,8);
reasons = outputNumeric(:,9);
regularity = outputNumeric(:,7);
indicesOfSpits = find(types==SPIT);
numEvents = length(starts);
eventGate = zeros(1,length(spitclip));
firstSpits = zeros(1,length(spitclip));
chainedSpits = zeros(1,length(spitclip));
maxVal = 800;
%loop through events and plot spits only
%color code by reason
for n = 1:length(indicesOfSpits)
i = indicesOfSpits(n);
if(reasons(i) == R_REGULARITY)
chainedSpits(starts(i):stops(i)) = regularity(i)*800;
else
firstSpits(starts(i):stops(i)) = maxVal;
end
end
plot(spitclip);
hold on;
grid on;
plot(lvl,'r');
plot(thresh, 'y');
plot(firstSpits, 'm');
plot(chainedSpits, 'k');
它看起來有點像聲音解析器 –