how to match the date ? and set a flag ?

5 Ansichten (letzte 30 Tage)
pruth
pruth am 6 Jul. 2020
Beantwortet: pruth am 6 Jul. 2020
I have created two mat files ! (attached)
I am finding nearest date and correspoding cell (from interpolated_radiosonde ) to mat_data_time dates.
  1. TT_out gives what exactly what i want. but additionally i also want to create another vector that will tell me the which date (from interpolated_radiosonde) it has chosen as nearest date.
  2. . The code below finds the nearest date but it doesn't tell how much nearest it is ! i want to add some syntax to this code which will create another timetable/mat file and give the list of dates which has gap more than 12 hours(or any number of hours I set).
any help will be appriciated. thank you.
load 'mat_data_time.mat'
load('interpolated_radiosonde.mat')
mat_data_time = datetime((mat_data_time(1,:))','ConvertFrom','datenum'); %selecting one time from the scan
T = timetable(interpolated_radiosonde(:,2),'RowTimes',datetime(interpolated_radiosonde(:,1),'ConvertFrom','datenum'));
TT_out = retime(T,mat_data_time,'nearest');
  1 Kommentar
pruth
pruth am 6 Jul. 2020
first question solved.
just had to add
T.Var2 = T.Time
before retime.
it gives me third vector in TT_out of matched data.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

pruth
pruth am 6 Jul. 2020
load('interpolated_radiosonde.mat')
mat_data_time = datetime((mat_data_time(1,:))','ConvertFrom','datenum'); %selecting one time from the scan
T = timetable(interpolated_radiosonde(:,2),'RowTimes',datetime(interpolated_radiosonde(:,1),'ConvertFrom','datenum'));
T.Var2 = T.Time ;
TT_out = retime(T,mat_data_time,'nearest');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%% to find flagg dates %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
thurshold_hour = hours(6) ;
for i = 1:size(TT_out)
if abs((TT_out.Time(i)-TT_out.Var2(i)))> thurshold_hour
TD(i) = TT_out.Time(i).';
end
end
TD = TD.';
flg_dates = ismissing(TD);
flagged_dates = TD(~flg_dates,:);
flagged_dates_difference = hours(TT_out.Time(:)-TT_out.Var2(:));

Weitere Antworten (0)

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by