Overview
Comment:mtt_isunique replaces unique which masks a built-in function.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 4f71d8387c28254fec36bfb6145ef73fd82ba30793c0ac35686f9cd02f713c1e
User & Date: geraint@users.sourceforge.net on 2012-10-15 19:22:44
Other Links: branch diff | manifest | tags
Context
2012-10-15
19:24:19
split is obsolete in Octave, replaced with strsplit check-in: 1ad9b88635 user: geraint@users.sourceforge.net tags: origin/master, trunk
19:22:44
mtt_isunique replaces unique which masks a built-in function. check-in: 4f71d8387c user: geraint@users.sourceforge.net tags: origin/master, trunk
19:18:03
split is obsolete in Octave, replaced with strsplit check-in: 4b9ee6dce3 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/m/mtt_isunique.m version [6397cfa01f].







































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function u = mtt_isunique(x);
% if all the elements of x are different, returns 1 else returns 0


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1  1997/09/18 19:38:58  peterg
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

n = length(x);
u=1

disp("--checking uniqueness --")
x
for i=1:n
  for j = 1:i-1
    if iscell(x)
      if x{i}==x{j}
	u = 0
	break;
      end;
    else
      if x(i)==x(j)
	u = 0
	break;
      end;
    end
  end;
end;

Modified mttroot/mtt/bin/trans/m/rbg2abg.m from [80cfe69023] to [c3c2325f5b].

1
2
3
4
5
6
7
8
9



10
11
12
13
14
15
16
function [bonds,components,n_vector_bonds] = rbg2abg(name,rbonds,rstrokes,rcomponents,\
				      port_coord,port_name,\
				      infofile,errorfile)

  ## ###############################################################
  ## ## Version control history
  ## ###############################################################
  ## ## $Id$
  ## ## $Log$



  ## ## Revision 1.49  2004/07/22 13:18:02  geraint
  ## ## Minor typo in error message.
  ## ##
  ## ## Revision 1.48  2004/02/19 18:27:47  geraint
  ## ## [ 852694 ] octave 2.1.52 breaks rbg2abg
  ## ##
  ## ## Octave now prefers row vectors to column vectors.









>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function [bonds,components,n_vector_bonds] = rbg2abg(name,rbonds,rstrokes,rcomponents,\
				      port_coord,port_name,\
				      infofile,errorfile)

  ## ###############################################################
  ## ## Version control history
  ## ###############################################################
  ## ## $Id$
  ## ## $Log$
  ## ## Revision 1.50  2009/11/02 16:54:03  geraint
  ## ## Replaced deprecated functions from Octave 2.1 for Octave 3.0: is_struct -> isstruct, struct_contains -> isfield, struct_elements -> fieldnames, is_complex -> iscomplex, setstr -> char
  ## ##
  ## ## Revision 1.49  2004/07/22 13:18:02  geraint
  ## ## Minor typo in error message.
  ## ##
  ## ## Revision 1.48  2004/02/19 18:27:47  geraint
  ## ## [ 852694 ] octave 2.1.52 breaks rbg2abg
  ## ##
  ## ## Octave now prefers row vectors to column vectors.
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
    
    
    ## Create the signed list of bonds on this component
    one = ones(n_comp_bonds,1);
    bond_list = index(:,1); %  bond at component
    
    ## Check that all bonds are unique -- error if not
    if unique(bond_list)==0
      mtt_error(sprintf("Component %s (%s) is at both ends of a bond", comp_name,
			comp_type),errorfile);
    endif
    
    

    ## which end of bond at component?







|







283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
    
    
    ## Create the signed list of bonds on this component
    one = ones(n_comp_bonds,1);
    bond_list = index(:,1); %  bond at component
    
    ## Check that all bonds are unique -- error if not
    if mtt_isunique(bond_list)==0
      mtt_error(sprintf("Component %s (%s) is at both ends of a bond", comp_name,
			comp_type),errorfile);
    endif
    
    

    ## which end of bond at component?


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]