⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 satsort.m

📁 航天工程工具箱
💻 M
字号:
function [ssat,i]=satsort(sat,el,d)
%SATSORT  Sort satellite structure array.
%   [SSAT,I] = SATSORT(SAT[,EL[,D]]) sorts the satellite structure
%   SAT with element EL in either ascending order D>0 (default) or
%   descending order D<0. The element number represents the following:
%
%      EL = 1 : a [m]          : semi-major axis (default)
%      EL = 2 : e []           : eccentricity
%      EL = 3 : i [deg]        : inclination
%      EL = 4 : W [deg]        : longitude of the ascending node
%      EL = 5 : w [deg]        : argument of periapsis
%      EL = 6 : M [deg]        : mean anomaly at epoch
%      EL = 7 : epoch [YMDhms] : timepoint for M
%      EL = 8 : name [string]  : name of satellite
%
%   See also ORB2CART, SORTROWS.

% Copyright (c) 2003-06-09, B. Rasmus Anthin.

if nargin<2, el=1;end
if nargin<3, d=1;end
for i=1:length(sat)
   oe(i,:)=sat(i).oe;
   epoch(i,:)=sat(i).epoch;
   name{i}=sat(i).name;
end
name=char(name);
if any(el==(1:6))
   [foo,i]=sortrows(oe,el);
elseif el==7
   [foo,i]=sortrows(epoch);
elseif el==8
   [foo,i]=sortrows(name);
else
   error('Invalid satellite structure element.')
end
ssat=sat(i);
if d<0
   i=flipud(i);
   ssat=sat(i);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -