Cleans Matlab syntax
by Kevin J. Delaney
17 Dec 2010
(Updated 15 Apr 2011)
Matlab routine (and associated Perl code) which cleans up syntax in Matlab code.
|
Watch this File
|
| File Information |
| Description |
Matlab-invoked Perl code which cleans up syntax in Matlab code you may have downloaded or inherited:
1) gets rid of trailing commas in "switch", "case", "if and "else" statements.
2) uncrowds mathematical operators and variable names by adding spaces
3) deletes trailing semicolons in "return", "end" and "function" statements.
4) automatically indents code.
Example: clean_Matlab_syntax('C:\Matlab Code\Project\old_m_file.m')
In this example, the code creates a new file named "old_m_file_cleaned.m" in same directory as the target file. |
| MATLAB release |
MATLAB 7.11 (2010b)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 20 Dec 2010 |
Added automatic indentation.
Wrapped Perl code into Matlab function which can be called either on a single .m file or on a whole directory. Allows user to replace existing files. |
| 15 Apr 2011 |
1) When separating statements & comments, now ignores "%" symbols within quoted strings.
2) More sophisticated indenting scheme. |
|
Contact us at files@mathworks.com