It's a couple of years since I installed Subversion on my Windows PC. Which is another reason you should be using one.Īnd, while you are thinking about all this, if you haven't already done so: check out Matlab's publish functionality.ĮDIT: I guess from your mention of TortoiseSVN that you are working on Windows. We don't generally put modification dates or histories in our source files, the repository tracks changes for us. You could write a script (in Matlab, why not) for maintaining the comment information you require, and implement some process to ensure that you run the script when necessary.You really should start using one right now.If you are not using a source code control system then: We put a block of comments right after the initial function line in (most of) our m-files. We keep our code in a Subversion repository and use the keywords functionality for writing this sort of information into the header comments of the m-file when it is committed to the repo. Since git uses hashes of files, you can't change the content of the file, without git thinking that it's been updated. $Author:, etc., are formatted for use with CSV/SVN. (I've just spotted a bug - the year should be before the company name in the copyright line. The Examples: and See also: lines are formatted in a way the works with the help report generator. If you have different use cases (maybe with and without optional arguments), then you should describe each one. It is important that this comes straight after the function definition line. The first line of the help documentation is known as the H1 line, and is used by the function lookfor, among others. (You'll obviously want a different company in your copyright statement.) % Copyright: Health and Safety Laboratory 2010 % = TESTFUNCTION(INPUTARGS) Explain usage here %TESTFUNCTION Summary of this function goes here The basic template for documentation that I use is function = TestFunction(inputArgs) You just type new at the command prompt, then the name of the function, and it sorts out the rest. %% Compute z(x, y) = x.I have a function in the MATLAB Central File Exchange that helps you document your function in a standard way, and works with version control software (CVS and Subversion not git) to automatically update the author field and time of modification. Specified by the function handle FUNC to arrays A and B, with implicit Y = myFunction(x) applies the element-by-element binary operation MyFunction Binary Singleton Expansion Function Do not include any other text on these lines. While commenting a block of code can be done by adding a % symbol at the beginning of each line, newer versions of MATLAB (after 2015a) let you use the Block Comment Operator % operators must appear alone on the lines. To uncomment a previously commented line remove the % symbol or use shortkey Crtl+T. It is helpful for others and even for the coder when returned later.Ī single line can be commented using the % symbol or using the shortkey Ctrl+R. It is a good practice to add comments that describe the code. Ordinary Differential Equations (ODE) Solvers.Fourier Transforms and Inverse Fourier Transforms.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |