Skip to main content

getCorrectStates.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function parsed the state variable based on the index provided.
% State positions are parsed if the index value is set to 1.
% State velocities are parsed if the index value is set to 2.
% State accelerations are parsed if the index value is set to 3.
%
% (2D matrix) -> (2D matrix, number, number)
% Returns parsed state varaible


function output = getCorrectStates(state, index, numCoordinates)

startIndex = (numCoordinates * (index - 1)) + 1;
endIndex = numCoordinates * index;
output = state(:, startIndex:endIndex);
end