-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReadTransData.m
44 lines (42 loc) · 1.21 KB
/
ReadTransData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function [Transmission rou]=ReadTransData(atomparam_atomno)
if atomparam_atomno==13
rou=2.70; % density [g/cm^3]
fileID=fopen('Al_transmission.txt','r');
Transmission=[];
while(~feof(fileID))
textdata=str2num(fgetl(fileID));
if isempty(textdata)
continue;
else
Transmission=[Transmission; textdata];
end
end
fclose(fileID);
elseif atomparam_atomno==26
rou=7.87; % density [g/cm^3]
fileID=fopen('Fe_transmission.txt','r');
Transmission=[];
while(~feof(fileID))
textdata=str2num(fgetl(fileID));
if isempty(textdata)
continue;
else
Transmission=[Transmission; textdata];
end
end
fclose(fileID);
else
sprintf('Warning: you are using the transmission data of Al by default. \n You may want to add transmission and density data for your own sample!')
rou=2.70; % density [g/cm^3]
fileID=fopen('Al_transmission.txt','r');
Transmission=[];
while(~feof(fileID))
textdata=str2num(fgetl(fileID));
if isempty(textdata)
continue;
else
Transmission=[Transmission; textdata];
end
end
fclose(fileID);
end