Error loading TLE file into satellite object

14 visualizzazioni (ultimi 30 giorni)
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 Commento
Andrew Mihalik
Andrew Mihalik il 23 Lug 2024
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].

Accedi per commentare.

Risposta accettata

Varun
Varun il 29 Gen 2024
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:
Hope it helps.
  2 Commenti
jose nuñez
jose nuñez il 30 Gen 2024
thanks for your clarification!
Andrew Mihalik
Andrew Mihalik il 23 Lug 2024
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].

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Signal Processing in Help Center e File Exchange

Tag

Prodotti


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by