Mercurial > hg > octave-lyh
comparison scripts/general/genvarname.m @ 9037:4cb9f994dcec
Documentation cleanup of var.texi, expr.texi, eval.texi
Spellcheck
Style check (particularly for two spaces after period)
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Sun, 22 Mar 2009 08:41:49 -0700 |
parents | eb63fbe60fab |
children | be55736a0783 |
comparison
equal
deleted
inserted
replaced
9036:58604c45ca74 | 9037:4cb9f994dcec |
---|---|
47 ## @} | 47 ## @} |
48 ## @end group | 48 ## @end group |
49 ## @end example | 49 ## @end example |
50 ## | 50 ## |
51 ## Note that the result is a char array/cell array of strings, not the | 51 ## Note that the result is a char array/cell array of strings, not the |
52 ## variables themselves. To define a variable, @code{eval()} can be | 52 ## variables themselves. To define a variable, @code{eval()} can be |
53 ## used. The following trivial example sets @code{x} to @code{42}. | 53 ## used. The following trivial example sets @code{x} to @code{42}. |
54 ## | 54 ## |
55 ## @example | 55 ## @example |
56 ## @group | 56 ## @group |
57 ## name = genvarname ("x"); | 57 ## name = genvarname ("x"); |
58 ## eval([name " = 42"]); | 58 ## eval([name " = 42"]); |
78 ## @end group | 78 ## @end group |
79 ## @end example | 79 ## @end example |
80 ## | 80 ## |
81 ## Since variable names may only contain letters, digits and underscores, | 81 ## Since variable names may only contain letters, digits and underscores, |
82 ## genvarname replaces any sequence of disallowed characters with | 82 ## genvarname replaces any sequence of disallowed characters with |
83 ## an underscore. Also, variables may not begin with a digit; in this | 83 ## an underscore. Also, variables may not begin with a digit; in this |
84 ## case an underscore is added before the variable name. | 84 ## case an underscore is added before the variable name. |
85 ## | 85 ## |
86 ## Variable names beginning and ending with two underscores "__" are valid but | 86 ## Variable names beginning and ending with two underscores "__" are valid but |
87 ## they are used internally by octave and should generally be avoided, therefore | 87 ## they are used internally by octave and should generally be avoided, therefore |
88 ## genvarname will not generate such names. | 88 ## genvarname will not generate such names. |
89 ## | 89 ## |
90 ## genvarname will also make sure that returned names do not clash with | 90 ## genvarname will also make sure that returned names do not clash with |
91 ## keywords such as "for" and "if". A number will be appended if necessary. | 91 ## keywords such as "for" and "if". A number will be appended if necessary. |
92 ## Note, however, that this does @strong{not} include function names, | 92 ## Note, however, that this does @strong{not} include function names, |
93 ## such as "sin". Such names should be included in @var{avoid} if necessary. | 93 ## such as "sin". Such names should be included in @var{avoid} if necessary. |
94 ## @seealso{isvarname, exist, tmpnam, eval} | 94 ## @seealso{isvarname, exist, tmpnam, eval} |
95 ## @end deftypefn | 95 ## @end deftypefn |
96 | 96 |
97 ## Authors: Rob Platt <robert.platt@postgrad.manchester.ac.uk> | 97 ## Authors: Rob Platt <robert.platt@postgrad.manchester.ac.uk> |
98 ## Bill Denney <bill@denney.ws> | 98 ## Bill Denney <bill@denney.ws> |