Last change
on this file was
4,
checked in by zhangj, 11 years ago
|
Initial import--MML version from SOLEIL@2013
|
File size:
1.2 KB
|
Line | |
---|
1 | function [T, badlist, errorstr] = isatlattice(LATTICE,varargin) |
---|
2 | %ISATLATTICE tests if an input argument is a valid AT lattice. |
---|
3 | % |
---|
4 | % A valid AT lattice is a MATLAB cell array of valid AT elements |
---|
5 | % |
---|
6 | % [TEST, BADLIST, ERRORSTR] = ISATLATTICE(ELEM, ['option1',...]) |
---|
7 | % |
---|
8 | % Allowed otions: |
---|
9 | % 'display' - print problems to command window; |
---|
10 | % 'stop' - return after the first problem is found |
---|
11 | % |
---|
12 | % TEST - test result, 1 = valid AT element |
---|
13 | % ERRORSTR - multi-line error message |
---|
14 | % |
---|
15 | % See also ISATELEM, ATELEM, ATLATTICE |
---|
16 | |
---|
17 | T = 1; |
---|
18 | errorstr = []; |
---|
19 | badlist = []; |
---|
20 | |
---|
21 | DISPLAYFLAG = 0; |
---|
22 | STOPFLAG = 0; |
---|
23 | |
---|
24 | if any(strncmpi(varargin,'disp',4)) |
---|
25 | DISPLAYFLAG = 1; |
---|
26 | end |
---|
27 | |
---|
28 | if any(strncmpi(varargin,'stop',4)) |
---|
29 | STOPFLAG = 1; |
---|
30 | end |
---|
31 | |
---|
32 | if ~ iscell(LATTICE) |
---|
33 | errorstr = [errorstr,sprintf('%s\n','Input is not a MATLAB cell array')]; |
---|
34 | T = 0; |
---|
35 | else |
---|
36 | for k = 1:length(LATTICE) |
---|
37 | [t, s] = isatelem(LATTICE{k}); |
---|
38 | if ~t |
---|
39 | badlist = [badlist, k]; |
---|
40 | T = 0; |
---|
41 | if DISPLAYFLAG |
---|
42 | s = [sprintf('\nInvalid lattice element # %s\n', int2str(k)),s]; |
---|
43 | disp(s); |
---|
44 | end |
---|
45 | if STOPFLAG |
---|
46 | return |
---|
47 | end |
---|
48 | end |
---|
49 | end |
---|
50 | errorstr = 'One or more elements are not valid AT elements'; |
---|
51 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.