Corresponding data arrangement problem
1 view (last 30 days)
Show older comments
I have four time series data, each time data length is different and each data has different gaps I want to sort them out according to the comparison date, so I first create a complete time axis
How do I make the data correspond to the time it belongs to and put it into the corresponding column attach my file The effect I want to achieve is similar to the excel I attached Because I want to use bar to present its data, I need to put the corresponding data together
0 Comments
Answers (1)
Lei Hou
on 24 Mar 2023
Hi Peter,
>> load('plot_tidal_asymmetry_data_112_wl_2.mat')
>> tt_112 = timetable(plot_end_time_yr_112_wl_2',main_asymmetry_112_wl_2',main_asymmetry_112_wl_2_bar,plot_sum_tidal_asymmetry_triads_num_112_wl_2','VariableNames',{'main_asymmetry_112_wl_2' 'main_asymmetry_112_wl_2_bar' 'plot_sum_tidal_asymmetry_triads_num_112_wl_2'})
>> load('plot_tidal_asymmetry_data_1102_wl_2.mat')
>> tt_1102 = timetable(plot_end_time_yr_1102_wl_2',main_asymmetry_1102_wl_2',main_asymmetry_1102_wl_2_bar,plot_sum_tidal_asymmetry_triads_num_1102_wl_2','VariableNames',{'main_asymmetry_1102_wl_2' 'main_asymmetry_1102_wl_2_bar' 'plot_sum_tidal_asymmetry_triads_num_1102_wl_2'})
>> load('plot_tidal_asymmetry_data_1116_wl_2.mat')
>> tt_1116 = timetable(plot_end_time_yr_1116_wl_2',main_asymmetry_1116_wl_2',main_asymmetry_1116_wl_2_bar,plot_sum_tidal_asymmetry_triads_num_1116_wl_2','VariableNames',{'main_asymmetry_1116_wl_2' 'main_asymmetry_1116_wl_2_bar' 'plot_sum_tidal_asymmetry_triads_num_1116_wl_2'})
>> load('plot_tidal_asymmetry_data_1436_wl_2.mat')
>> tt_1436 = timetable(plot_end_time_yr_1436_wl_2',main_asymmetry_1436_wl_2',main_asymmetry_1436_wl_2_bar,plot_sum_tidal_asymmetry_triads_num_1436_wl_2','VariableNames',{'main_asymmetry_1436_wl_2' 'main_asymmetry_1436_wl_2_bar' 'plot_sum_tidal_asymmetry_triads_num_1436_wl_2'})
>> tt = synchronize(tt_112,tt_1102,tt_1116,tt_1436)
tt =
35×12 timetable
Time main_asymmetry_112_wl_2 main_asymmetry_112_wl_2_bar plot_sum_tidal_asymmetry_triads_num_112_wl_2 main_asymmetry_1102_wl_2 main_asymmetry_1102_wl_2_bar plot_sum_tidal_asymmetry_triads_num_1102_wl_2 main_asymmetry_1116_wl_2 main_asymmetry_1116_wl_2_bar plot_sum_tidal_asymmetry_triads_num_1116_wl_2 main_asymmetry_1436_wl_2 main_asymmetry_1436_wl_2_bar plot_sum_tidal_asymmetry_triads_num_1436_wl_2
___________ _______________________ _______________________________________ ____________________________________________ ________________________ _______________________________________ _____________________________________________ ________________________ _______________________________________ _____________________________________________ ________________________ _________________________________________ _____________________________________________
31-Dec-1951 NaN NaN NaN NaN NaN 0.26639 0.29424 -0.0148 -0.013051 0.33558 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1953 NaN NaN NaN NaN NaN -0.086358 -0.11334 0.017934 0.0090482 -0.13631 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1955 NaN NaN NaN NaN NaN 0.069314 0.049025 0.020282 6.7497e-06 0.041818 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1957 NaN NaN NaN NaN NaN 0.0511 0.018285 0.033564 -0.00074825 0.057067 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1959 NaN NaN NaN NaN NaN 0.019352 0.022804 -0.0027581 -0.00069359 0.036589 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1961 NaN NaN NaN NaN NaN -0.0057549 -0.042404 0.033073 0.0035765 -0.044242 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1963 NaN NaN NaN NaN NaN -0.027709 -0.05559 0.020879 0.007001 0.036814 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1965 NaN NaN NaN NaN NaN -0.022244 -0.029785 0.0044687 0.0030724 -0.040044 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1969 NaN NaN NaN NaN NaN -0.066137 -0.094939 0.028659 0.00014271 -0.010536 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1971 NaN NaN NaN NaN NaN -0.18947 -0.17038 -0.01004 -0.0090536 -0.18113 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
31-Dec-1973 NaN NaN NaN NaN NaN -0.11287 -0.085395 -0.028358 0.00088489 -0.1084 NaN NaN NaN NaN NaN 0.014166 0.019471 -0.013323 0.0080181 0.012136
: : : : : : : : : : : : :
31-Dec-2001 0.03207 0.026066 -0.010157 0.01616 0.031573 0.053213 0.039369 0.014563 -0.00071887 0.011054 -0.015739 0.024193 -0.01467 -0.025262 -0.015598 NaN NaN NaN NaN NaN
31-Dec-2003 -0.031383 -0.040934 -0.013026 0.022577 -0.031703 -0.031548 -0.049876 0.021014 -0.002686 -0.072253 0.053349 0.057457 -0.017285 0.013176 0.051255 -0.029609 -0.022554 -0.0024101 -0.0046445 -0.026542
31-Dec-2005 -0.078674 -0.04977 -0.00098186 -0.027922 -0.08015 0.069844 0.056118 0.019239 -0.0055136 -0.0052635 -0.010873 0.0021299 -0.012388 -0.00061527 -0.012206 -0.0093268 -0.020488 0.0091918 0.0019693 -0.0080205
31-Dec-2007 0.037756 0.080269 -0.014261 -0.028252 0.034638 0.14796 0.15528 -0.0030424 -0.0042786 0.11641 0.039896 0.04923 -0.020131 0.010797 0.045699 0.016412 0.019259 -0.012214 0.0093669 0.018587
31-Dec-2009 -0.099792 -0.061664 -0.0066194 -0.031508 -0.10754 -0.18414 -0.086861 -0.00619 -0.091086 -0.50633 0.032959 0.055016 -0.022079 2.2165e-05 0.029932 0.022498 0.018639 -0.00014331 0.0040028 0.020369
31-Dec-2011 -0.098349 -0.080599 0.0072445 -0.024994 -0.093391 -0.01947 -0.035081 0.01643 -0.00081847 0.0036598 0.037581 0.033193 -0.0072986 0.011686 0.033403 0.037826 0.018888 0.012879 0.0060595 0.034431
31-Dec-2013 0.10467 0.056995 0.011195 0.036477 0.12637 0.20943 0.22665 0.013524 -0.030742 0.13818 0.031478 0.051611 -0.007724 -0.012408 0.026956 0.00096473 -0.00059378 0.0066965 -0.005138 -0.00085702
31-Dec-2015 -0.020785 -0.056108 0.012345 0.022978 -0.023904 -0.0081235 0.028664 -0.011627 -0.02516 -0.109 -0.013326 -0.054366 0.024277 0.016763 -0.013452 0.0052183 -0.0051179 0.014128 -0.0037922 0.0036449
31-Dec-2017 -0.10966 -0.12825 0.012653 0.0059333 -0.09846 -0.085978 -0.09217 -0.014282 0.020474 -0.026212 0.076486 0.059032 0.011876 0.0055775 0.072806 0.010684 -0.0049836 0.012948 0.0027199 0.01146
31-Dec-2019 0.12805 0.071649 0.0054729 0.050927 0.13043 0.11875 0.20591 -0.0072936 -0.079868 -0.047419 0.035328 -0.012123 0.021073 0.026378 0.034132 0.0090387 0.002547 0.0035261 0.0029655 0.0044127
31-Dec-2021 -0.059676 0.0044596 0.0051614 -0.069297 -0.065802 0.031988 0.037986 -0.0050555 -0.00094273 0.014526 0.024494 0.03367 0.0070983 -0.016275 0.019657 0.028032 0.011231 0.012938 0.0038637 0.025186
Display all 35 rows.
0 Comments
See Also
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!