I\'m looking for a function in Matlab to use for error messages, like so:
error([\'Invalid value for someVariable: \' wantedFunction(someVariable)]);
Come to think of it, I remember doing something a long time ago quite similar to what angainor has done in his answer. I'll post it here for anyone interested in converting arbitrary things to string, and generally having more control over how that conversion is done.
It supports empties, logicals, chars, function handles, numerics, cells, struct (arrays), and user-defined classes (sparse arrays in the next update).
EDIT: I've taken this as a template for an update that I ended up placing on the file exchange. Feel free to experiment it and modify to suit your needs.