Error loading TLE file into satellite object
8 次查看(过去 30 天)
显示 更早的评论
I'm creating a GPS scenario loading current TLE into the satellite object with following commands:
% Create Scenario
startTime = datetime('now', 'Format', 'yyyy-MM-dd HH:mm:ss');
stopTime = startTime;
sampleTime = 1; % secs
sc = satelliteScenario(startTime,stopTime,sampleTime);
% Load TLE
websave('tledata.tle', 'https://celestrak.org/NORAD/elements/gp.php?GROUP=gps-ops&FORMAT=tle');
% Put satellites into the scenario
sats = satellite(sc,'tledata.tle');
But I obtain following error:
Error using satelliteScenario/satellite>throwExceptions
Unable to add satellite to the satelliteScenario.
Error in satelliteScenario/satellite
Caused by:
Incorrect size for expression 'time.fmt': expected [1x0] but found [1x19].
Has anyone an idea on what's going on? TLE file seems to be OK.
1 个评论
Andrew Mihalik
2024-7-23
Hello, if we assume I ran the following code:
sc = satelliteScenario;
StartTime_datestring= '2024-07-22 17:52:39'
StopTime_datestring= '2024-08-23 17:52:39'
Can anyone explain why, then, this code executes correctly and without error:
StartTime_datetime=datetime(StartTime_datestring,'InputFormat','yyyy-MM-dd HH:mm:ss');
StopTime_datetime=datetime(StopTime_datestring,'InputFormat','yyyy-MM-dd HH:mm:ss');
sc.StartTime=StartTime_datetime
sc.StopTime=StopTime_datetime
But this code:
StartTime_datetime=datetime(StartTime_datestring,'Format','yyyy-MM-dd HH:mm:ss');
StopTime_datetime=datetime(StopTime_datestring,'Format','yyyy-MM-dd HH:mm:ss');
sc.StartTime=StartTime_datetime
sc.StopTime=StopTime_datetime
creates an error saying Incorrect size for expression 'time.fmt': expected [1x0] but found [1x19].
采纳的回答
Varun
2024-1-29
Hi Jose,
Looks like the error is related to the size of the 'time.fmt' field in the TLE file. The expected size is [1x0], but the error indicates that it found [1x19].
I debugged the code and found that the error is occurring due to the first line because of using ‘Format’ name-value pair in the ‘datetime’ function:
startTime = datetime('now', 'Format', 'yyyy-MM-dd HH:mm:ss');
To resolve this error, you can simply replace this line with the following line which is independent of ‘Format’ name-value pair:
startTime = datetime('now');
Please refer to the following documentations to learn more:
‘satelliteScenario’: https://www.mathworks.com/help/aerotbx/ug/satellitescenario.html
Hope it helps.
2 个评论
Andrew Mihalik
2024-7-23
Hello, if we assume I ran the following code:
sc = satelliteScenario;
StartTime_datestring= '2024-07-22 17:52:39'
StopTime_datestring= '2024-08-23 17:52:39'
Can anyone explain why, then, this code executes correctly and without error:
StartTime_datetime=datetime(StartTime_datestring,'InputFormat','yyyy-MM-dd HH:mm:ss');
StopTime_datetime=datetime(StopTime_datestring,'InputFormat','yyyy-MM-dd HH:mm:ss');
sc.StartTime=StartTime_datetime
sc.StopTime=StopTime_datetime
But this code:
StartTime_datetime=datetime(StartTime_datestring,'Format','yyyy-MM-dd HH:mm:ss');
StopTime_datetime=datetime(StopTime_datestring,'Format','yyyy-MM-dd HH:mm:ss');
sc.StartTime=StartTime_datetime
sc.StopTime=StopTime_datetime
creates an error saying Incorrect size for expression 'time.fmt': expected [1x0] but found [1x19].
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Satellite Mission Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!