comparing the minutes values of two tables

2 次查看(过去 30 天)
I am trying to make a comparison between the minutes value of the time from two tables using the following lines
first we checck if the dates are matching then we check if the value of the minutes in t2 satisfy the following:
minute of t2-30mins<=minute of t2<=minute of t2+30mins
[Lia2, Locb2] = ismember(t1.Date3, t2.date2);
indx2 = Locb2(Locb2 > 0);
% Tminu = '30:00';
% infmt = 'mm:ss';
% Dminu = duration(Tminu,'InputFormat',infmt);
t2.minadd30=minute(t2.date)+minutes(30);
t2.minsubtract30=minute(t2.date)-minutes(30);
t2mins=minute(t2.date);
if ( t2mins(indx2)>= t2.minsubtract30 && t2mins(indx2)<= t2.minadd30)
t1.foF2(Lia2)=t2.fof2(indx2);
if m==1
datatable=t1;
else
datatable=[datatable; t1];
end
end
but I am getting the following error
perands to the logical and (&&) and or (||) operators must be convertible to logical scalar values.
Error in Ionosonde_Data (line 112)
if ( t2mins(indx2)>= t2.minsubtract30 && t2mins(indx2)<= t2.minadd30)

回答(1 个)

Mahmoud Ashraf
Mahmoud Ashraf 2022-3-31
try this
all(condition1)&&all(condition2)

类别

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

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by