Home > lattice > isatlattice.m

isatlattice

PURPOSE ^

ISATLATTICE tests if an input argument is a valid AT lattice.

SYNOPSIS ^

function [T, badlist, errorstr] = isatlattice(LATTICE,varargin)

DESCRIPTION ^

ISATLATTICE tests if an input argument is a valid AT lattice.
 
  A valid AT lattice is a MATLAB cell array of valid AT elements
   
  [TEST, BADLIST, ERRORSTR] = ISATLATTICE(ELEM, ['option1',...])

  Allowed otions: 
   'display' - print problems to command window;
   'stop'    - return after the first problem is found
 
  TEST     - test result,  1 = valid AT element
  ERRORSTR - multi-line error message
    
  See also ISATELEM, ATELEM, ATLATTICE

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [T, badlist, errorstr] = isatlattice(LATTICE,varargin)
0002 %ISATLATTICE tests if an input argument is a valid AT lattice.
0003 %
0004 %  A valid AT lattice is a MATLAB cell array of valid AT elements
0005 %
0006 %  [TEST, BADLIST, ERRORSTR] = ISATLATTICE(ELEM, ['option1',...])
0007 %
0008 %  Allowed otions:
0009 %   'display' - print problems to command window;
0010 %   'stop'    - return after the first problem is found
0011 %
0012 %  TEST     - test result,  1 = valid AT element
0013 %  ERRORSTR - multi-line error message
0014 %
0015 %  See also ISATELEM, ATELEM, ATLATTICE
0016 
0017 T = 1;
0018 errorstr = [];
0019 badlist = [];
0020 
0021 DISPLAYFLAG = 0;
0022 STOPFLAG = 0;
0023 
0024 if any(strncmpi(varargin,'disp',4))
0025     DISPLAYFLAG = 1;
0026 end
0027 
0028 if any(strncmpi(varargin,'stop',4))
0029     STOPFLAG = 1;
0030 end
0031 
0032 if ~ iscell(LATTICE)
0033     errorstr = [errorstr,sprintf('%s\n','Input is not a MATLAB cell array')];
0034     T = 0;
0035 else
0036     for k = 1:length(LATTICE)
0037         [t, s] = isatelem(LATTICE{k});
0038         if ~t
0039             badlist = [badlist, k];
0040             T = 0;
0041             if DISPLAYFLAG
0042                 s = [sprintf('\nInvalid lattice element # %s\n', int2str(k)),s];
0043                 disp(s);
0044             end
0045             if STOPFLAG
0046                 return
0047             end
0048         end
0049     end
0050     errorstr = 'One or more elements are not valid AT elements';
0051 end

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005