Warning message identifier

matlab, warnings

Solution

Try something like this:

warning('myfun:warncode','Warning message!')

Problem

I would like to include the `warning()` command in my MATLAB code. Ironically, in doing so, I get a warning message in the code editor that I'm unable to shift. If I use the line `warning('Warning message!')`, the code editor tells me I need to include a 'message identifier' as the first argument. So, I consulted `help warning`, which informs me that 'message identifier' is simply a string. If I use the following line: `warning('identifier','Warning message!')`, I still get complaints from the editor. First of all, it still wants me to add a 'message identifier' as the first argument. In addition, it now tells me that 'the format string might not agree with the argument count'. How do I resolve this? I'm using MATLAB 2012a.

Original source