Quantitative finance collector
C++ Matlab VBA/Excel Java Mathematica R/Splus Net Code Site Other
May 31

Matlab File Style

Posted by bo at 18:29 | Code » Matlab | Comments(0) | Reads(6694)
Programming style, a set of rules or guidelines used when writing the source code for a computer program, is important for a programmer, it not only allows the reviewers to know the date and author of the file, but also helps the programmer himself to track the file version and improve work efficiency. Nevertheless, repetitive comments, especially for the header part are boring. Uncomment is even more boring, read Matlab comment stripping for a lazy way for that.
Open in new window

NEWFCN is a good function I always use when creating new files, basically it creates a M-File having the entered filename and a specific structure which helps for creating the main function structure. The actual working MATLAB Version will be also captured. For example, running newfcn('testnewfcn') generates a file named testnewfcn.m at a pre-defined style, the new file looks like
function testnewfcn()
%   ...

%% AUTHOR    : aBiao @ mathfinance.cn
%% $DATE     : 28-May-2010 18:55:27 $
%% $Revision : 1.00 $
%% DEVELOPED : (R14) Service Pack 3
%% FILENAME  : testnewfcn.m

disp(' !!!  You must enter code into this file < testnewfcn.m > !!!')
% ===== EOF ====== [testnewfcn.m] ======  

Did I mention you can customize the exact style by modifying newfcn.m to the appearance you like? just that simple!

Download at http://www.mathworks.com/matlabcentral/fileexchange/6408  

Add a comment
Enable HTML
Enable UBB
Enable Emots
Nickname   Password   Optional
Site URI   Email   [Register]