propagateOrbit function fails on Epoch field format

I am feeding the same tleStruct data to the propagateOrbit function twice, but in one case propagageOrbit is successful, and in the other case it fails with the following error message:
Error using propagateOrbit
An error was encountered when propagating the orbit of spacecraft at index 1 using sdp4 orbit propagator.
error in test_TLE (line 17)
[r1,v1] = propagateOrbit(epoch_date,tleStruct,PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
Caused by:
Error using – (line 43)
Cannot combine or compare a datetime array within a time zone with one without a time zone.
The tleStruct data looks identical in both cases. In the first case, I use tleread() to input the data and feed it directly to propagateOrbit. In the second case, I write the tleStruct to an Excel .csv file, read it back in as a new tleStruct, and feed it to propagateOrbit. That is when I run into issues with the epoch_date and tleStruct.Epoch fields.
Here is a sample test script:
function test_TLE()
epoch_date = datetime(’09-Mar-2025 07:26:58′);
tleStruct = struct;
input_pathname = pwd;
[filename, filepath] = uigetfile(fullfile(input_pathname, ‘*.tle’));
fullpath = strcat(filepath,filename);
[~,name,~] = fileparts(filename);
csv_filepath = strcat(filepath, name, ‘.csv’);
if isfile(csv_filepath)
csvtext = readtable(csv_filepath);
tleStruct = table2struct(csvText);
% script fails here:
[r1,v1] = propagateOrbit(epoch_date,tleStruct, PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
disp(num2str(r1);
else
tleStruct = tleread(fullpath);
[r1,v1] = propagateOrbit(epoch_date,tleStruct, PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
disp(num2str(r1);
% save struct to file so you can read it in faster the next time:
tleTable = struct2table(tleStruct);
tlePath = strrep(fullpath,’.tle’,’.csv’);
writetable(tleTable, tlePath, ‘Delimiter’, ‘,’, ‘fileType’, ‘text’);
end
end
input file "day_068.tle":
1 00011U 59001A 25067.89046599 +.00002526 +00000-0 +13240-2 0 9994
2 00011 32.8783 45.0235 1450212 290.5993 54.5192 11.89297186480028
Output file "day_068.csv":
Name SatelliteCatalogNumber Epoch Bstar RightAscensionOfAscendingNode Eccentricity Inclination ArgumentOfPeriapsis MeanAnomaly MeanMotion
UNKNOWN 11 3/8/2025 21:22 0.001324 45.0235 0.1450212 32.8783 290.5993 54.5192 0.049554049
The Epoch field appears as shown above in the Excel table. When you examine it in the edit field, it says "3/8/2025 9:22:16 PM
The first time you run the script, it will read the TLE file and create a tleStruct for propagateOrbit() to read. This call is successful. It then outputs a new "day_068.csv" file to save time on subsequent function calls.
The second time you run the script, it reads the "day_068.csv" file and converts it to a tleStruct. When you attempt to read this
tleStruct into propagateOrbit(), it throws an error.
Apparently propagateOrbit calls arithUtil(a,b) which checks for datetime compatibility and throws an exception.
The time fields appear identical to me in both cases, when I examine them in the tleStruct.Epoch field. Is Excel doing something funny to the datetime structure?I am feeding the same tleStruct data to the propagateOrbit function twice, but in one case propagageOrbit is successful, and in the other case it fails with the following error message:
Error using propagateOrbit
An error was encountered when propagating the orbit of spacecraft at index 1 using sdp4 orbit propagator.
error in test_TLE (line 17)
[r1,v1] = propagateOrbit(epoch_date,tleStruct,PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
Caused by:
Error using – (line 43)
Cannot combine or compare a datetime array within a time zone with one without a time zone.
The tleStruct data looks identical in both cases. In the first case, I use tleread() to input the data and feed it directly to propagateOrbit. In the second case, I write the tleStruct to an Excel .csv file, read it back in as a new tleStruct, and feed it to propagateOrbit. That is when I run into issues with the epoch_date and tleStruct.Epoch fields.
Here is a sample test script:
function test_TLE()
epoch_date = datetime(’09-Mar-2025 07:26:58′);
tleStruct = struct;
input_pathname = pwd;
[filename, filepath] = uigetfile(fullfile(input_pathname, ‘*.tle’));
fullpath = strcat(filepath,filename);
[~,name,~] = fileparts(filename);
csv_filepath = strcat(filepath, name, ‘.csv’);
if isfile(csv_filepath)
csvtext = readtable(csv_filepath);
tleStruct = table2struct(csvText);
% script fails here:
[r1,v1] = propagateOrbit(epoch_date,tleStruct, PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
disp(num2str(r1);
else
tleStruct = tleread(fullpath);
[r1,v1] = propagateOrbit(epoch_date,tleStruct, PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
disp(num2str(r1);
% save struct to file so you can read it in faster the next time:
tleTable = struct2table(tleStruct);
tlePath = strrep(fullpath,’.tle’,’.csv’);
writetable(tleTable, tlePath, ‘Delimiter’, ‘,’, ‘fileType’, ‘text’);
end
end
input file "day_068.tle":
1 00011U 59001A 25067.89046599 +.00002526 +00000-0 +13240-2 0 9994
2 00011 32.8783 45.0235 1450212 290.5993 54.5192 11.89297186480028
Output file "day_068.csv":
Name SatelliteCatalogNumber Epoch Bstar RightAscensionOfAscendingNode Eccentricity Inclination ArgumentOfPeriapsis MeanAnomaly MeanMotion
UNKNOWN 11 3/8/2025 21:22 0.001324 45.0235 0.1450212 32.8783 290.5993 54.5192 0.049554049
The Epoch field appears as shown above in the Excel table. When you examine it in the edit field, it says "3/8/2025 9:22:16 PM
The first time you run the script, it will read the TLE file and create a tleStruct for propagateOrbit() to read. This call is successful. It then outputs a new "day_068.csv" file to save time on subsequent function calls.
The second time you run the script, it reads the "day_068.csv" file and converts it to a tleStruct. When you attempt to read this
tleStruct into propagateOrbit(), it throws an error.
Apparently propagateOrbit calls arithUtil(a,b) which checks for datetime compatibility and throws an exception.
The time fields appear identical to me in both cases, when I examine them in the tleStruct.Epoch field. Is Excel doing something funny to the datetime structure? I am feeding the same tleStruct data to the propagateOrbit function twice, but in one case propagageOrbit is successful, and in the other case it fails with the following error message:
Error using propagateOrbit
An error was encountered when propagating the orbit of spacecraft at index 1 using sdp4 orbit propagator.
error in test_TLE (line 17)
[r1,v1] = propagateOrbit(epoch_date,tleStruct,PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
Caused by:
Error using – (line 43)
Cannot combine or compare a datetime array within a time zone with one without a time zone.
The tleStruct data looks identical in both cases. In the first case, I use tleread() to input the data and feed it directly to propagateOrbit. In the second case, I write the tleStruct to an Excel .csv file, read it back in as a new tleStruct, and feed it to propagateOrbit. That is when I run into issues with the epoch_date and tleStruct.Epoch fields.
Here is a sample test script:
function test_TLE()
epoch_date = datetime(’09-Mar-2025 07:26:58′);
tleStruct = struct;
input_pathname = pwd;
[filename, filepath] = uigetfile(fullfile(input_pathname, ‘*.tle’));
fullpath = strcat(filepath,filename);
[~,name,~] = fileparts(filename);
csv_filepath = strcat(filepath, name, ‘.csv’);
if isfile(csv_filepath)
csvtext = readtable(csv_filepath);
tleStruct = table2struct(csvText);
% script fails here:
[r1,v1] = propagateOrbit(epoch_date,tleStruct, PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
disp(num2str(r1);
else
tleStruct = tleread(fullpath);
[r1,v1] = propagateOrbit(epoch_date,tleStruct, PropModel="sdp4",OutputCoordinateFrame="fixed-frame");
disp(num2str(r1);
% save struct to file so you can read it in faster the next time:
tleTable = struct2table(tleStruct);
tlePath = strrep(fullpath,’.tle’,’.csv’);
writetable(tleTable, tlePath, ‘Delimiter’, ‘,’, ‘fileType’, ‘text’);
end
end
input file "day_068.tle":
1 00011U 59001A 25067.89046599 +.00002526 +00000-0 +13240-2 0 9994
2 00011 32.8783 45.0235 1450212 290.5993 54.5192 11.89297186480028
Output file "day_068.csv":
Name SatelliteCatalogNumber Epoch Bstar RightAscensionOfAscendingNode Eccentricity Inclination ArgumentOfPeriapsis MeanAnomaly MeanMotion
UNKNOWN 11 3/8/2025 21:22 0.001324 45.0235 0.1450212 32.8783 290.5993 54.5192 0.049554049
The Epoch field appears as shown above in the Excel table. When you examine it in the edit field, it says "3/8/2025 9:22:16 PM
The first time you run the script, it will read the TLE file and create a tleStruct for propagateOrbit() to read. This call is successful. It then outputs a new "day_068.csv" file to save time on subsequent function calls.
The second time you run the script, it reads the "day_068.csv" file and converts it to a tleStruct. When you attempt to read this
tleStruct into propagateOrbit(), it throws an error.
Apparently propagateOrbit calls arithUtil(a,b) which checks for datetime compatibility and throws an exception.
The time fields appear identical to me in both cases, when I examine them in the tleStruct.Epoch field. Is Excel doing something funny to the datetime structure? propagateorbit, tleread MATLAB Answers — New Questions

​

Leave a Reply

Your email address will not be published. Required fields are marked *