I\'m looking for a function in Matlab to use for error messages, like so:
error([\'Invalid value for someVariable: \' wantedFunction(someVariable)]);
Yes, although it's not straightforward. You have to use the disp in combination with evalc:
string = evalc(['disp(someVariable)'])
You could cast this into more manageable form:
toString = @(var) evalc(['disp(var)']);
So, for your example:
>> var = {rand(3,1), 'A', struct('test', 5)};
>> error(['Invalid value for var: ' toString(var)])
??? Invalid value for var: [3x1 double] 'A' [1x1 struct]