Skip to main content

verifyParam.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% verifyParam takes a struct and checks that the field exists and passes
% the value to the fn to verify the field's type. If it can't verify these
% steps, throw and exception with the string given
%
% (struct, string, function, string) -> (None)
% Runs the Muscle Tendon Personalization algorithm


function verifyParam(structure, field, evalFunction, errorMessage)
if(~isfield(structure, field))
throw(MException('', errorMessage))
end
try
evalFunction(structure.(field))
catch
throw(MException('', errorMessage))
end
end