Skip to main content

parseGcpStandard.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function pulls the files from the directory given as the input.
% These files are then organized into a 3D matrix with dimensions matching:
% (numFrames, numTrials, numMuscles). An OpenSim model is used to properly
% parse .mot files.
%
% (String, Array of string) -> (3D matrix of number)
% returns a 3D matrix of the loaded data trials


function output = parseGcpStandard(model, files)
import org.opensim.modeling.*
[~, ~, dataFromFileOne] = parseMotToComponents(Model(model), Storage(files(1)));
cells = zeros([length(files) ...
size(dataFromFileOne)]);
cells(1, :, :) = dataFromFileOne;
for i=2:length(files)
[~, ~, cells(i, :, :)] = parseMotToComponents(Model(model), Storage(files(1)));
end
output = permute(cells, [3, 1, 2]);
end