source: MML/trunk/machine/SOLEIL/StorageRing/RadiaMapGui/DeleteLineRadiaMap.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 DeleteRadiaMapLine(PathName,FileName,x,Bx,Bz,Lu,forder,funit,deleteLnstr,str)
2
3
4%% find the extension of the file
5exid = strfind(FileName,'.');
6extension = FileName(exid:end);
7%find the main file name
8savefilename = [PathName,FileName(1:exid-1)];
9
10%%  delete the lines from the data
11
12% get the size of Bx and Bz before delete
13    [Pz Px] = size(Bx); 
14   
15if (strncmp(deleteLnstr,'first',5))
16   DLn = 1;
17elseif(strncmp(deleteLnstr,'last',4)&&strncmp(str,'horizontal',10))
18    DLn = Pz;
19elseif(strncmp(deleteLnstr,'last',4)&&strncmp(str,'vertical',8))
20    DLn = Px-1;
21end
22
23   
24   
25switch str 
26    case 'horizontal'
27      Bx(DLn,:) =[];
28      Bz(DLn,:) =[];
29 
30     
31    case 'vertical'
32      Bx(:,DLn+1) =[];    % the first colum of Bx is y cooridinates
33      Bz(:,DLn+1) =[];    % the first colum of Bx is y cooridinates
34   end   
35   
36%% get the size of Bx and Bz
37    [Pz Px] = size(Bx);   
38
39%% save the data into a file
40fid =fopen([savefilename,'_delete',extension],'wt');
41%save the headlines
42fprintf(fid,'%s\n','# Author:  User');
43fprintf(fid,'%s\n',['# ',FileName,' after delete the line' ]);
44fprintf(fid,'%s\n','# Undulator Length [m]');
45fprintf(fid,'%-10.2f\n',Lu);
46fprintf(fid,'%s\n','# Number of Horizontal Points');
47fprintf(fid,'%d\n',Px);
48fprintf(fid,'%s\n','# Number of Vertical Points');
49fprintf(fid,'%d\n',Pz);
50
51
52
53%save the interploted horizontal kick
54fprintf(fid,'%s\n',['# Horizontal ',forder,' Order Kick ',funit]);
55fprintf(fid,'%s\n','START');
56fprintf(fid,'    %10.5e',x); %the first element is non exit
57fprintf(fid,'\n');
58for i=1:Pz
59fprintf(fid,'%10.5e   ',Bz(i,:));
60fprintf(fid,'\n');
61end
62
63%save the interploted vertical kick
64fprintf(fid,'%s\n',['# Vertical ',forder,' Order Kick ',funit]);
65fprintf(fid,'%s\n','START');
66fprintf(fid,'    %10.5e',x); %the first element is non exit
67fprintf(fid,'\n');
68for i=1:Pz
69fprintf(fid,'%10.5e   ',Bx(i,:));
70fprintf(fid,'\n');
71end
72
73fclose(fid);
Note: See TracBrowser for help on using the repository browser.