Ken & Mike on the MATLAB Desktop
May 18th, 2009
M-Lint across a project
Oftentimes I find myself working not just on one MATLAB file, but a whole project-full of multiple files. When I’m in a multi-file mode, I like to know how my code is doing and how much cleanup work I still have to do to get the files into a stable, presentable state. The M-Lint code checker built in to the Editor is a great tool for analyzing and fixing a single file, but not practical when you have a bunch of files.
Why open a series of files consecutively and tab between them just to find the outstanding messages when you can use the M-Lint report to see them all at once?
The report lets you see all the unresolved warnings and errors in all your files at once. This provides a quick way to gauge the health of your project.
There are two ways to get to the M-Lint report. First is through the Current Directory Browser:
The other is through the mlintrpt command. By default The M-Lint report uses your active M-Lint configuration, but you can use this command to specify an alternative configuration. See our previous post about M-Lint configurations for more details.
Let us know how M-Lint has helped or hindered your project-wide workflows.
By
Michael Katz
Mike is a developer on the MATLAB Desktop team. When not describing himself in the third person, biking, homebrewing, or rooting for the home team, he's busy trying to make the world a better place for programming.
14:33 UTC |
Posted in Current Directory, M-Lint |
Permalink |
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply
|
This is useful - glad I stumbled upon it. What I’m looking for, though, is how to easily search and replace all occurrences of a whole word in multiple files (i.e. all files in a directory). Basically, I want the same functionality provided by Ctrl+F with the “whole words only” option but with the ability to perform on multiple files at once.
After writing my PSO toolbox, I decided that some of my variables could have been named more transparently. For example, “Ns” could be named “num_trials_successful” so as to be obvious in meaning to any user. I’ve been going through the process: Ctrl+Home, Ctrl+F, Alt+A (with “whole words only” selected), click in m-file, Ctrl+S, click new tab, repeat. But lately I’ve been breaking my code up into m-files of specific purpose to make it easier to understand, and making project-wide improvements is now a more painful process.
A simple search and replace is not what I want though since “ns,” for example, could occur within words, which is why I want to keep the “whole words only” option.
Any ideas???
@George : Are you looking for the “Find Files tool” (just select Edit > Find Files from any desktop tool):
Finding Files and Content Within Files in Any Directory
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f10-14803.html#brpyzt7-1
For all my projects I use M-Lint to find unused variables or variables growing in the loop for example.
Aurélien
George,
This is a capability we’re definitely interested in bringing to the editor. If you think it’s safe to a string replace, you can use regexrep and file i/o to just parse through your files and replace a string. It’s not as nice or clean as it will be when we have a GUI.
Hi i pretty happy with this concept, but is there any way we can make our customize file as read only , bcoz if you ignore this mLint warning in editor it updates the mLint configuaration file , is there any way to disable “Ignore This “m-Lint ” on right click.
There’s no way to disable the disabling of a message. You can make an individual configuration file read only on the system, but that won’t prevent a user from changing his configuration.
Can we please make these tools have a “recursive” option? Would be very useful, especially for code written using package directories!
Thanks!
Tom,
Thanks for the suggestion. These tools predate classes and packages and the infrastructure they use doesn’t really deal well with the workflow. We’re working on a much more useful and comprehensive solution, but that will take a few releases.
Thanks for the suggestion.