source: MML/trunk/machine/SOLEIL/StorageRing/insertions/idGetListOfOrbitsWithNaN.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.9 KB
Line 
1function Result=idGetListOfOrbitsWithNaN(Directory, CoreFileName, GetAllFileNames)
2% Written by F. Briquez 03/11/2011
3% CoreFileName should contain an '*' character. If not, the '*' character
4% is added at the end of CoreFileName, assuming the constant part of the
5% name is its begining.
6% Prints names of .mat files in which X or Z orbits contain at least one NaN
7% GetAllFileNames=1 => reminds also the name of a file not containing NaN
8   
9    AsteriskPosition=findstr(CoreFileName, '*');
10    if (isempty(AsteriskPosition)==1)
11        CoreFileName=[CoreFileName, '*'];
12    end
13    if (size(CoreFileName, 2)>4)
14        EndOfName=CoreFileName(size(CoreFileName,2)-4:size(CoreFileName, 2));
15        if (strcmp(EndOfName, '.mat')==0)
16            CoreFileName=[CoreFileName, '.mat'];
17        end
18    else
19        CoreFileName=[CoreFileName, '.mat'];
20    end
21    ListOfFiles=dir([Directory, filesep, CoreFileName]);
22    NumberOfFiles=size(ListOfFiles, 1);
23       
24    for i=1:NumberOfFiles
25%     i=1;
26        File=ListOfFiles(i);
27        FileName=File.name;
28        FullFileName=[Directory, filesep, FileName];
29        Structure=load(FullFileName);
30        if (isstruct(Structure))
31            if (isfield(Structure, 'X')&&isfield(Structure, 'Z'))
32                OrbitX=Structure.X;
33                OrbitZ=Structure.Z;
34                if (sum(isnan(OrbitX))~=0)
35                    fprintf('File %s : Orbit X\n', FileName)
36                else
37                    if (GetAllFileNames)
38                        fprintf('NO PROBLEM WITH File %s : Orbit X\n', FileName)
39                    end
40                end
41                if (sum(isnan(OrbitZ))~=0)
42                    fprintf('File %s : Orbit Z\n', FileName)
43                else
44                    if (GetAllFileNames)
45                        fprintf('NO PROBLEM WITH File %s : Orbit Z\n', FileName)
46                    end
47                end
48            end
49        end
50    end
51    return
52end
53       
Note: See TracBrowser for help on using the repository browser.