I\'m looking for a function in Matlab to use for error messages, like so:
error([\'Invalid value for someVariable: \' wantedFunction(someVariable)]);
Looks weird, but
str = matlab.unittest.diagnostics.ConstraintDiagnostic.getDisplayableString(value)
does the job for you instead using that unesthetic evalc(disp()) approach.
evalc(disp())