annotate scripts/control/system/__sysgroupn__.m @ 7017:a1dbe9d80eee

[project @ 2007-10-12 21:27:11 by jwe]
author jwe
date Fri, 12 Oct 2007 21:27:37 +0000
parents 93c65f2a5668
children 59dcf01bb3e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
1 ## Copyright (C) 1996, 1998, 2000, 2004, 2005, 2007
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
2 ## Auburn University. All rights reserved.
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
3 ##
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
4 ## This file is part of Octave.
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
5 ##
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
7 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
9 ## your option) any later version.
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
10 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
14 ## General Public License for more details.
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
15 ##
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6945
diff changeset
18 ## <http://www.gnu.org/licenses/>.
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
19
6945
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 5307
diff changeset
20 ## Undocumented internal function.
6bbf56a9718a [project @ 2007-10-02 20:47:22 by jwe]
jwe
parents: 5307
diff changeset
21
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
22 ## -*- texinfo -*-
3500
7923abdeb4e5 [project @ 2000-01-31 06:35:00 by jwe]
jwe
parents: 3438
diff changeset
23 ## @deftypefn {Function File} {} __sysgroupn__ (@var{names})
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
24 ## Locate and mark duplicate names
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
25 ## inputs:
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
26 ## names: list of signal names
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
27 ## kind: kind of signal name (used for diagnostic message purposes only)
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
28 ## outputs:
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
29 ## returns names with unique suffixes added; diagnostic warning
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
30 ## message is printed to inform the user of the new signal name
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
31 ##
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
32 ## used internally in sysgroup and elsewhere.
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
33 ## @end deftypefn
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
34
3438
2e06c3941943 [project @ 2000-01-14 06:33:18 by jwe]
jwe
parents: 3437
diff changeset
35 function names = __sysgroupn__ (names, kind)
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
36
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
37 ## check for duplicate names
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
38 l = length(names);
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
39 ii = 1;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
40 while(ii <= l-1)
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3500
diff changeset
41 st1 = names{ii};
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
42 jj = ii+1;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
43 while ( jj <= l)
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3500
diff changeset
44 st2 = names{jj};
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
45 if(strcmp(st1,st2))
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
46 suffix = ["_",num2str(jj)];
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
47 warning("sysgroup: %s name(%d) = %s name(%d) = %s", ...
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
48 kind,ii,kind,jj,st1);
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
49 strval = sprintf("%s%s",st2,suffix);
4771
b8105302cfe8 [project @ 2004-02-16 17:45:50 by jwe]
jwe
parents: 3500
diff changeset
50 names{jj} = strval;
3437
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
51 warning("sysgroup: changed %s name %d to %s",kind,jj,strval);
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
52 ## restart the check (just to be sure there's no further duplications)
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
53 ii = 0; jj = l;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
54 endif
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
55 jj = jj+1;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
56 endwhile
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
57 ii = ii+1;
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
58 endwhile
3c609681b2bf [project @ 2000-01-14 06:00:00 by jwe]
jwe
parents:
diff changeset
59 endfunction