Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Thomas West MSc Dissertation MATLAB Code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas West
Thomas West MSc Dissertation MATLAB Code
Commits
e078bf28
Commit
e078bf28
authored
10 months ago
by
Thomas West
Browse files
Options
Downloads
Patches
Plain Diff
Cursor function when studying .mat figures.
parent
ec315925
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Function/Cursor_Function.m
+37
-0
37 additions, 0 deletions
Function/Cursor_Function.m
with
37 additions
and
0 deletions
Function/Cursor_Function.m
0 → 100644
+
37
−
0
View file @
e078bf28
%% Function Description (Cursor Function)
% The `Cursor_Function` enhances plot interactivity by customizing data tips in MATLAB plots. It dynamically
% generates detailed tooltips that display the departure and arrival dates, the time of flight (TOF), and the delta-v
% (∆V) based on the cursor's position over plot data points. This function is typically used to provide additional
% context for data points in plots related to time series or trajectory analyses, improving data readability and
% user interaction.
% Author: Thomas West
% Date: April 18, 2024
%% Function
function
output_txt
=
Cursor_Function
(
obj
,
event_obj
)
% Customizes text of data tips
pos
=
get
(
event_obj
,
'Position'
);
% Get the position of the cursor
% Convert serial date number to MATLAB date number
departure_date
=
datenum
(
'2000-01-01 12:00:00'
)
+
(
pos
(
1
)
-
730486
);
% Convert the numeric date to a string format
departure_str
=
datestr
(
departure_date
,
'dd-mmm-yyyy'
);
tof_days
=
pos
(
2
);
% Time of Flight in days
% Calculate arrival date by adding TOF to departure date
arrival_date
=
addtodate
(
departure_date
,
round
(
tof_days
),
'day'
);
% Convert arrival date to string format
arrival_str
=
datestr
(
arrival_date
,
'dd-mmm-yyyy'
);
% Format output text to display in the data tip
output_txt
=
{
...
[
'Departure Date: '
,
departure_str
],
...
[
'TOF: '
,
num2str
(
tof_days
,
'%.1f'
),
' days'
],
...
[
'Arrival Date: '
,
arrival_str
],
...
[
'∆V: '
,
num2str
(
pos
(
3
),
'%.5g'
),
' km/s'
]
...
};
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment