I'm programming up a custom class and want to throw an undefined operator error (like would occur if you executed {[]}*{[]}). I know I need to make an error structure with the message, the stack, and the identifier. It's the last that I'm having trouble with, I don't understand how MException works. I tried out the following code
myError.stack = dbstack;
myError.identifier = MException('foo:noBar','You did not foo bar.');
myError.message = ['You did not foo bar.'];
error(myError)
but get the error
Error using error
Field "identifier" of input structure must contain a valid MATLAB message identifier.
But I don't know what valid identifiers are because the help section just seems to go in circles.
Is there a list of valid identifiers that I'm missing? Or some additional resource?