-
Notifications
You must be signed in to change notification settings - Fork 0
/
Catalog_Link.m
78 lines (56 loc) · 1.58 KB
/
Catalog_Link.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
close all
clear all
clc
%fid = fopen('3Line_Full_Catalog.txt','rb');
fid = fopen('cubesatTLE.txt','rb');
l1=1;
l2=1;
l3=1;
fseek(fid, 0, 'eof');
fileSize = ftell(fid);
frewind(fid);
data = fread(fid, fileSize, 'uint8');
%# Count number of line-feeds and increase by one.
numLines = sum(data == 10) + 1;
fclose(fid);
[Cube_ID,Cube_name] = xlsread('Control_Group.xlsx','Cube_ID','A2:B214');
[Spheres_ID,Sphere_name] = xlsread('Control_Group.xlsx','Calibration_Spheres','A3:B20');
%fid = fopen('3Line_Full_Catalog.txt','rb');
fid = fopen('cubesatTLE.txt','rb');
L1 = blanks(24);
for i = 1 : numLines-1
tline = fgets(fid);
tline(1);
if str2num(tline(1)) == 1
L2(l2,:) = tline;
l2 = l2 + 1;
end
if str2num(tline(1)) == 2
L3(l3,:) = tline;
l3 = l3 + 1;
end
if ischar(tline(1)) == 1 %& str2num(tline(1)) ~= 2
L1(l1,1:length(tline)) = tline;
l1 = l1 + 1;
end
end
fclose(fid);
%%
SATCAT = L1(:,3:24);
sat_number1 = str2num(L2(:,3:7));
classification = L2(:,8);
ID = L2(:,10:17);
epoch = str2num(L2(:,19:32));
mean_motion1 = str2num(L2(:,34:43));
mean_motion2 = str2num(L2(:,45:52));
BSTAR = (L2(:,54:61));
emphemeris = str2num(L2(:,63));
element_number = str2num(L2(:,65:68));
sat_number2 = str2num(L3(:,03:07));
inclination = str2num(L3(:,09:16));
RAAN = str2num(L3(:,18:25));
eccentricity = (L3(:,27:33));
arg_of_perigiee = (L3(:,35:42));
mean_anomaly = (L3(:,44:51));
mean_motion = (L3(:,53:63));
rev_number = str2num(L3(:,64:68));