How to apply the IF condition between the time range 4 am to 6pm of everyday of the year
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ritika Srinivasan
le 7 Fév 2022
Réponse apportée : Srija Kethiri
le 17 Fév 2022
Hi ,
I am trying to check the load requirement within a certain time range. I have one table with dates and hourly time value in the following format :
01.01.2021 00:00 and the corresponding pv production value for one year. I want to run a loop to check if the values between 4 am and 18:00 pm of each day of the year are greater than 5 or not. I would much appreciate any help
Best Regards,
Ritika
1 commentaire
Réponse acceptée
Srija Kethiri
le 17 Fév 2022
Hi Ritika,
To apply the if condition between time range of 4am to 6am for everyday of the year.
You can use the below code
%Data is stored in the table T
%Convert the table into a cell array
A = table2array(T);
%Split the array A with the delimiter space
D = split(A);
%By using the for loop go through the data D and check whether the condition is satisfied or not
%If the condition is satisfied store it in dataTable
j=0;
for i=1:height(T)
if(f(i,2)>=”04:00” && f(i,2)<=”18:00”)
dataTable(j,1) = T(i,1);
j++;
end
end
% The required answer is stored in dataTable.
For more information about table2array refer this link:
For more information about split function refer this link:
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Type Conversion dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!