% This function is part of the NMSM Pipeline, see file for full license.
%
% This function checks that the initial guess control file is in the 
% correct order
%
% (struct) -> (struct)
% 
function inputs = checkControlGuess(inputs)
if isfield(inputs.initialGuess, 'control')
    for i = 1 : inputs.numCoordinates
        for k = 1 : length(inputs.initialGuess.controlLabels)
            if strcmpi(inputs.coordinateNames(i), inputs.initialGuess.controlLabels(k))
                controlIndex(i) = k;
            end
        end 
    end
    inputs.initialGuess.control(:, 1:inputs.numCoordinates) = ...
        inputs.initialGuess.control(:, controlIndex);
end
end