Comments |
Comments in Octaves script and function files.
|
function xdot = f (x, t) # usage: f (x, t) # # This function defines the right-hand-side functions for a set of # nonlinear differential equations. r = 0.25 and so on ... endfunction
The help command is able to find the first block of comments in a function (even those that are composed directly on the command line). This means that users of Octave can use the same commands to get help for built-in functions, and for functions that you have defined. For example, after defining the function f above, the command
help f
produces the output
usage: f (x, t) This function defines the right-hand-side functions for a set of nonlinear differential equations.
Although it is possible to put comment lines into keyboard-composed throw-away Octave programs, it usually isn't very useful, because the purpose of a comment is to help you or another person understand the program at a later time.