comparing the minutes values of two tables

2 views (last 30 days)
Salma fathi
Salma fathi on 31 Mar 2022
Commented: Arif Hoq on 31 Mar 2022
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)

Answers (1)

Mahmoud Ashraf
Mahmoud Ashraf on 31 Mar 2022
try this
all(condition1)&&all(condition2)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!