-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvisualizer.m
More file actions
38 lines (35 loc) · 765 Bytes
/
visualizer.m
File metadata and controls
38 lines (35 loc) · 765 Bytes
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
function visualizer(filename)
clc;
close all;
% Input 'all' plots all files that match trajectory*
% Otherwise, plot a single trajectory with the input filename
filenames = {};
if strcmp(filename, 'all')
files = dir;
for i = 1:length(files)
if startsWith(files(i).name, 'trajectory')
filenames = [filenames{:} {files(i).name}];
end
end
else
filenames = {filename};
end
% Assemble trajector(ies) for plotting
X = {};
Y = {};
Z = {};
for i = 1:length(filenames)
pos = readmatrix(filenames{i});
X{i} = pos(:,1);
Y{i} = pos(:,2);
Z{i} = pos(:,3);
end
% Plotting
figure;
earth_sphere('m');
hold on;
for i = 1:length(filenames)
plot3(X{i}, Y{i}, Z{i}, 'r', 'LineWidth', 1);
end
view(103.8171, 8.7652)
end