how to make datetime data readable and convert to julian date?
Show older comments
greeting sir, I want to convert date time with YYYY/MM/DD HH:MM:SS format in my file to julian date. When I load my data, the datenumber changed to NaN
This is what I've tried
clc;clear; close all;
% Specify the folder where the files live.
myFolder = 'C:\ZTD\CSV';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isfolder(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s\nPlease specify a new folder.', myFolder);
uiwait(warndlg(errorMessage));
myFolder = uigetdir(); % Ask for a new one.
if myFolder == 0
% User clicked Cancel
return;
end
end
Allfile = fullfile(myFolder, '*.txt'); % Change to whatever pattern you need.
List = dir(Allfile);
for k = 1 : length(List)
sites = List(k).name;
num = readmatrix(sites,"NumHeaderLines",1);
num(:,end)=[];
time = num(1:end,1);
% % julian date corresponding to 2000-01-01 00:00:00.0
mjd20000 = 51544;
How to make my date time data readable and calculate it to julian date?
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!