7017
|
1 ## Copyright (C) 1996, 1998, 2000, 2004, 2005, 2006, 2007 |
|
2 ## Auburn University. All rights reserved. |
3437
|
3 ## |
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
7016
|
7 ## under the terms of the GNU General Public License as published by |
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
3437
|
10 ## |
7016
|
11 ## Octave is distributed in the hope that it will be useful, but |
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 ## General Public License for more details. |
3437
|
15 ## |
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
3437
|
19 |
6945
|
20 ## Undocumented internal function. |
|
21 |
3437
|
22 ## -*- texinfo -*- |
3500
|
23 ## @deftypefn {Function File} {} __sysdefioname__ (@var{n}, @var{str}, @var{m}) |
3437
|
24 ## return default input or output names given @var{n}, @var{str}, @var{m}. |
|
25 ## @var{n} is the final value, @var{str} is the string prefix, and @var{m} |
|
26 ## is start value |
|
27 ## |
|
28 ## used internally, minimal argument checking |
|
29 ## |
3438
|
30 ## @strong{Example} @code{ioname = __sysdefioname__(5,"u",3)} |
4771
|
31 ## returns the cell array: |
3437
|
32 ## @example |
|
33 ## ioname = |
|
34 ## ( |
|
35 ## [1] = u_3 |
|
36 ## [2] = u_4 |
|
37 ## [3] = u_5 |
|
38 ## ) |
|
39 ## @end example |
|
40 ## @end deftypefn |
|
41 |
3438
|
42 function ioname = __sysdefioname__ (n, str, m) |
3437
|
43 |
|
44 if (nargin < 2 | nargin > 3) |
6046
|
45 print_usage (); |
3437
|
46 endif |
|
47 |
|
48 if (nargin == 2) m = min(1,n); endif |
|
49 |
4771
|
50 ioname = {}; |
3437
|
51 jj = 1; |
|
52 if(n > 0 & m > 0 & m <= n) |
|
53 for ii = m:n |
4771
|
54 ioname{ii+1-m} = sprintf("%s_%d",str,ii); |
3437
|
55 endfor |
|
56 elseif(m > n) |
|
57 error("str=%s; start value m=%d > final value n=%d",str,m,n); |
|
58 endif |
|
59 |
|
60 endfunction |