ADDED mttroot/mtt/bin/trans/m/mtt_isunique.m Index: mttroot/mtt/bin/trans/m/mtt_isunique.m ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/m/mtt_isunique.m @@ -0,0 +1,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; + Index: mttroot/mtt/bin/trans/m/rbg2abg.m ================================================================== --- mttroot/mtt/bin/trans/m/rbg2abg.m +++ mttroot/mtt/bin/trans/m/rbg2abg.m @@ -5,10 +5,13 @@ ## ############################################################### ## ## 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 @@ -282,11 +285,11 @@ ## 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 + 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