Rearrange time and turn it into Julian time

2 次查看(过去 30 天)
Hi to all
I have data in file h172.csv
I write the code to open this
>clear
>load h172.csv
>[~, txt] = xlsread('h172.csv');
> JOPR_cells = regexp(txt(1:end),',', 'split');
>JOPR_cell =vertcat(JOPR_cells{:});
>JOPR = str2double(JOPR_cell);
>y = JOPR(:,1); % years
>m = JOPR(:,2); %months
>d = JOPR(:,3); %days
>h = JOPR(:,4); %hour
>sl = JOPR(:,5); %sea level (WL)
i want to rearrange history time like %formatOut = 'dd/mm/yyyy HH:MM:SS'; (Datatime) and in to Julian time (jday)
the table finaly example like this.
Picture1.png

采纳的回答

Akira Agata
Akira Agata 2019-12-1
How about the following?
% Read the csv file
D = dlmread('h172.csv');
% Generate datetime vector
Time = datetime(D(:,1),D(:,2),D(:,3),D(:,4),0,0);
% Change display format
Time.Format = 'dd/MM/yyyy HH:mm:SS';
% Calculate julian date
Jday = juliandate(Time);
% Extract WL
WL = D(:,5);
% Arrange them to a table variable
T = table(Jday,Time,WL);
  2 个评论
nada
nada 2019-12-3
the error i have
Undefined function 'datetime' for input arguments of type 'double'.
i have, Issuance matlab is R2014a
Akira Agata
Akira Agata 2019-12-3
Oh, that's because the function 'datetime' was introduced in R2014b.
A simple and better solution is to upgrade your MATLAB. Otherwise, we have to think about other solution...

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by