3279
|
1 # Copyright (C) 1996,1998 Auburn University. All Rights Reserved. |
3213
|
2 # |
|
3 # This file is part of Octave. |
|
4 # |
|
5 # Octave is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License as published by the |
|
7 # Free Software Foundation; either version 2, or (at your option) any |
|
8 # later version. |
|
9 # |
|
10 # Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # for more details. |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License |
|
16 # along with Octave; see the file COPYING. If not, write to the Free |
3284
|
17 # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. |
3213
|
18 |
|
19 function ioname = sysdefioname(n,str,m) |
|
20 # function ioname = sysdefioname(n,str[,m]) |
3228
|
21 # return list of default input or output names given n, str, m |
3213
|
22 # n is the final value, str is the string prefix, and m is start value |
|
23 # ex: ioname = sysdefioname(5,"u",3) |
|
24 # |
3228
|
25 # returns: ioname = |
|
26 # ( |
|
27 # [1] = u_3 |
|
28 # [2] = u_4 |
|
29 # [3] = u_5 |
|
30 # ) |
3213
|
31 # used internally, minimal argument checking |
|
32 |
|
33 if (nargin < 2 | nargin > 3) |
|
34 usage("ioname = sysdefioname(n,str[,m])"); |
|
35 endif |
|
36 |
3228
|
37 if (nargin == 2) m = min(1,n); endif |
3213
|
38 |
3228
|
39 ioname = list(); |
3213
|
40 jj = 1; |
|
41 if(n > 0 & m > 0 & m <= n) |
|
42 for ii = m:n |
3228
|
43 ioname(ii+1-m) = sprintf("%s_%d",str,ii); |
3213
|
44 endfor |
|
45 elseif(m > n) |
3228
|
46 error("str=%s; start value m=%d > final value n=%d",str,m,n); |
3213
|
47 endif |
|
48 |
|
49 endfunction |