Skip to main content

processRawEmgFile.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% Produce a new processed EMG file using RCNL's protocol for turning a
% matrix of double of EMG data into processed EMG data.
%
% (2D Array of double, 1D Array of double, string, struct) -> (None)
% Processes the input EMG data by RCNL's protocol


function processRawEmgFile(emgFilename, filterOrder, highPassCutoff, ...
lowPassCutoff, processedEmgFileName)
emgStorage = org.opensim.modeling.Storage(emgFilename);
timePoints = findTimeColumn(emgStorage);
columnNames = getStorageColumnNames(emgStorage);
rawData = storageToDoubleMatrix(emgStorage);

processedData = processEmg( ...
rawData, ...
timePoints, ...
struct( ...
"filterOrder", filterOrder, ...
"highPassCutoff", highPassCutoff, ...
"lowPassCutoff", lowPassCutoff ...
));

writeToSto(columnNames, timePoints, processedData, processedEmgFileName);
end