annotate scripts/control/system/__sysgroupn__.m @ 6746:a8105a726e68

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