How do I make an array from select points in a large table (based on dates)?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alex Bertone
le 6 Juin 2022
Commenté : Alex Bertone
le 14 Juin 2022
I have a 10668x2 table, where the first column is date and time (for each day over 2 months at time incrememnts of 5 minutes) and the second column is numerical data points. I am very new to MATLAB and I need to make an array with just data from 12:00 to 1:00 for each day.
Thanks!
OrgPollution = table(Time,Org)
2 commentaires
Image Analyst
le 6 Juin 2022
That's not large at all. Make it each for people to help you and attach your data and code to read it in with the paperclip icon after you read this:
Also, there is a huge variety of functions that deal with date and time. I'm sure you can find the proper one to pull out the days you want, and the hours you want. Just check the help.
Réponse acceptée
Peter Perkins
le 13 Juin 2022
Alex, you already have a timetable, which is the right thing to use. To help get you started:
>> i = isbetween(timeofday(UMR2021Summer.Time),"12:00:00","13:00:00","closedleft");
>> UMR2021SummerNoonToOne = UMR2021Summer(i,:)
UMR2021SummerNoonToOne =
498×5 table
Time Org SO4 NH4 NO3
____________________ _______ _______ _______ ________
26-Jun-2021 12:00:00 NaN NaN NaN NaN
26-Jun-2021 12:05:00 NaN NaN NaN NaN
26-Jun-2021 12:10:00 0.33556 0.63947 0.40095 0.041775
26-Jun-2021 12:14:59 0.20017 0.63614 0.32735 0.039437
26-Jun-2021 12:19:59 0.30853 0.64951 0.33269 0.030284
26-Jun-2021 12:25:00 0.37215 0.64442 0.3304 0.045167
26-Jun-2021 12:30:00 0.40201 0.61505 0.34874 0.059202
26-Jun-2021 12:35:00 0.33406 0.64511 0.35743 0.054811
26-Jun-2021 12:40:00 0.39917 0.61458 0.31331 0.047046
26-Jun-2021 12:45:00 0.39838 0.61313 0.32964 0.039666
26-Jun-2021 12:50:00 0.24139 0.63526 0.37212 0.045749
26-Jun-2021 12:55:00 0.35982 0.62534 0.38926 0.034411
27-Jun-2021 12:00:00 0.62955 0.50621 0.33769 0.044799
27-Jun-2021 12:05:00 0.42514 0.4432 0.30758 0.044894
27-Jun-2021 12:10:00 0.45459 0.47431 0.3124 0.035452
27-Jun-2021 12:15:00 0.48091 0.41638 0.25182 0.050077
27-Jun-2021 12:20:00 0.41357 0.40914 0.26832 0.045522
27-Jun-2021 12:25:00 0.45695 0.39716 0.27624 0.048118
27-Jun-2021 12:30:00 0.56791 0.41429 0.28475 0.03607
27-Jun-2021 12:35:00 0.76539 0.40887 0.32575 0.037567
: : : : :
31-Jul-2021 12:20:00 1.0541 0.42781 0.24191 0.046103
31-Jul-2021 12:25:00 0.92958 0.43776 0.2597 0.043812
31-Jul-2021 12:30:00 0.97799 0.44306 0.26491 0.047766
31-Jul-2021 12:35:00 1.2014 0.42217 0.26631 0.053551
31-Jul-2021 12:40:00 1.1449 0.45877 0.28319 0.048117
31-Jul-2021 12:45:00 1.1976 0.43803 0.18249 0.05062
31-Jul-2021 12:50:00 1.3696 0.45324 0.27546 0.064099
31-Jul-2021 12:55:00 1.3155 0.45333 0.30821 0.058208
01-Aug-2021 12:00:00 0.84366 1.7602 0.49288 0.057661
01-Aug-2021 12:05:00 1.0101 1.7067 0.8235 0.048553
01-Aug-2021 12:10:00 1.1104 1.736 0.76208 0.050668
01-Aug-2021 12:15:00 1.0062 1.7079 0.83471 0.053539
01-Aug-2021 12:20:00 1.0702 1.7758 0.79786 0.051115
01-Aug-2021 12:25:00 1.2205 1.827 0.84708 0.059524
01-Aug-2021 12:29:59 1.179 1.832 0.824 0.07162
01-Aug-2021 12:35:00 1.064 1.6916 0.77543 0.051889
01-Aug-2021 12:40:00 1.19 1.7305 0.83541 0.051257
01-Aug-2021 12:45:00 1.235 1.8954 0.87276 0.063986
01-Aug-2021 12:50:00 1.3016 1.7557 0.83395 0.071728
01-Aug-2021 12:55:00 1.1856 1.7181 0.74352 0.058065
Display all 498 rows.
timerange is also very useful with timetables, although at the moment, it can't pick out what you need. More here.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dates and Time 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!