I love the new possibilities for customizing M-Lint messages I see in the new R2006b release based on my active settings.
Contents
Preferences
To see what I'm talking about, look at this screenshot of my MATLAB Preferences selection for M-Lint. I can select and deselect messages based on what I want to see, and saved combinations of these messages in named files. I have saved three difference choices, in addition to the default. However, when I actually look at what I've done, two are the same. I really wanted to stop seeing certain messages when I am writing this blog!
How to Create New Settings
Based on the screenshot you just saw, I'm sure you can figure out how to customize the M-Lint messages for yourself. Simply go to the M-Lint section of the MATLAB preferences, check and uncheck boxes, and choose Save As... to save your selection.
Other Ways to Customize Messages
The R2006b release of MATLAB has other ways to customize the messages you see. You can choose to:
- Always ignore a particular message
- Ignore this message this time
The way to accomplish either of these tasks is to right-click with your mouse on the actual underlined location where a message is generated. When you do, you will see two choices at the top of the context menu% * Ignore this message * Disable all message
Activate Alternate Settings
In the preferences, you choose which M-Lint settings are active. You can change this in the editor by right-clicking with your mouse on the overall M-Lint status square towards the top of the right side, the column where the M-Lint messages are indicated.
References
Here are some more references on how you can use the new M-Lint preferences.
Are these new preferences useful to you? Let me know.
Published with MATLAB® 7.3



I find M-Lint messages to be annoying when I’m in the editor writing m-files, but I find them useful for optimization suggestions when I use the profiler. There’s some rather unsettling about having an m-file that does not have a green light from M-Lint. Like one instance it complains that a variable is not used, but I have to declare it because I need a dummy output so I can get the second output parameter from a function, which I care about.
I like this new featur, because its an easier way getting rid of abnnoying messages like “insert a semi-colon to supress output” without typing %#ok in every line.
Good improvement.
Michael
This is very useful. I write a lot of mexFunctions. To document them, I write a companion m-file with all the arguments specified in the first line, ample “help” comments, and then a single statement “error (‘xxx mexFunction not found’)”. The sole purpose of the m-file is to document the mexFunction. mlint constantly complains that my arguments are unused, but they are supposed to be unused. Adding %#ok to the first line is ugly in this case, since the m-file is not for MATLAB to read, but for the end-user to read. The %#ok in the first line distracts the reader. If mlint were smart enough, it could recognize that the first statement in the m-file was “error”, and it should ignore the non-use of any input/output parameters or failure to define output parameters.
In an altogether different state of mind ;-) … we *really* need to *add* another mlint warning. Whenever a goto statement is used mlint should report “warning: go to statement considered harmful” (see http://blogs.mathworks.com/loren/?p=29 and http://www.acm.org/classics/oct95/ for more details). This warning has been noted for almost 40 years … I’m amazed that the warning message has not yet been added to MATLAB.
(This suggestion is for real, not tongue-in-cheek as the “goto” comment was): m-lint should invoke a warning if it sees inv(A)*x, “Multiplying by the inverse is slow and potentially inaccurate; use A\x instead.” I’m amazed at how often I see “inv(A)” misused this way.
Great suggesetion, Tim. We happened to have that one already recorded in our list. For the future, the best way to send enhancements to us is to use this link.
–Loren