MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

2015-11-15 04:53:11 36 80


Load the timetable with weather measurements. Display the first five rows of outdoors.


load outdoors
outdoors(1:5,:)


ans=5×4 timetable
Time Humidity TemperatureF PressureHg




2015-11-15 00:00:24 49 51.3 29.61
2015-11-15 01:30:24 48.9 51.5 29.61
2015-11-15 03:00:24 48.9 51.5 29.61
2015-11-15 04:30:24 48.8 51.5 29.61
2015-11-15 06:00:24 48.7 51.5 29.6


Synchronize Timetables


The timetables, indoors and outdoors, contain different measurements taken inside
and outside a building at different times. Combine all the data into one timetable with the
synchronize function.


tt = synchronize(indoors,outdoors);
tt(1:5,:)


ans=5×6 timetable
Time Humidity_indoors AirQuality Humidity_outdoors TemperatureF PressureHg




2015-11-15 00:00:24 36 80 49 51.3 29.61
2015-11-15 01:13:35 36 80 NaN NaN NaN
2015-11-15 01:30:24 NaN NaN 48.9 51.5 29.61
2015-11-15 02:26:47 37 79 NaN NaN NaN
2015-11-15 03:00:24 NaN NaN 48.9 51.5 29.61


The output timetable, tt contains all the times from both timetables. synchronize puts
a missing data indicator where there are no data values to place in tt. When both input
timetables have a variable with the same name, such as Humidity, synchronize
renames both variables and adds both to the output timetable.


Create Timetables
Free download pdf