-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathtrajGetSection.m
40 lines (34 loc) · 1.01 KB
/
trajGetSection.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
function traj_section = trajGetSection( traj, varargin )
% trajGetSection returns a trajectory section struct.
%
% Inputs:
% traj trajectory struct, see trajInit
% section_idx the index of the section to be returned
%
% Outputs:
% traj_section trajectory section struct, see trajSectionInit
%
% Syntax:
% traj = trajGetSection( traj )
% traj = trajGetSection( traj, section_idx )
%
% See also: trajInit, trajSectionSet
%
% Disclaimer:
% SPDX-License-Identifier: GPL-3.0-only
%
% Copyright (C) 2020-2022 Fabian Guecker
% Copyright (C) 2022 TU Braunschweig, Institute of Flight Guidance
% *************************************************************************
section_idx = 0 ;
if isempty(varargin)
section_idx(:) = traj.active_section;
else
section_idx(:) = varargin{1};
end
if section_idx > traj.num_sections_set || section_idx < 1
%warning('Invalid section index. First section will be returned.');
section_idx(:) = 1;
end
traj_section = traj.sections(section_idx);
end