Plot of head against velocity data based on timestamp similarity
1 view (last 30 days)
I have 2 excel files named TimeStamps_Uy.xlsx and Head_Timestamps.xlsx. In file one: TimeStamps_Uy.xlsx column 1 have a Timestamps and column 2 have the velocity data. In file two: column 1 have a Timestamps and column 2 have the Head data. I want to use TimeStamps_Uy.xlsx file and all of its Timestamps to fine the similar Timestamps in the Head_Timestamps.xlsx hence on matching plot the corresponding data (head/Uy) from both files column 2 for the same or near enough time stamp hence save the timestamp, head, and Uy into new xlsx or csv file. How would I do that? I have attached both the xlsx file in this post. I have tried but getting nowhere! Code below is just show the path and normal reading of data from column.
Code so far:
Uy_dir = 'F:\3-PIV_Experimental_Data\Outlet_110\Data_LaserSheet_D\Data_PIV\5-AverageFilter_VelocitiesExtration\Point_Velocities\Uy\TimeStamps_Uy.xlsx';
a = readmatrix(Uy_dir);
Head_dir = 'F:\3-PIV_Experimental_Data\Outlet_110\Data_LaserSheet_D\Data_Head\Data_Raw\Head_Timestamps.xlsx';
a = readmatrix(Head_dir);
Jon on 10 Mar 2022
Edited: Jon on 10 Mar 2022
First read in both of your datafiles.
Then use MATLAB function interp1 to interpolate values at times matching the times in one of the data files (doesn't matter which one)
So suppose that you have vectors tu, u for times and corresponding velocities and also th, h for times and corresponding head values. Then you could interpolate values of head at times matching those in the velocity data using
hq = interp1(th,h,tu)
and then if you wanted to plot head vs velocity you could plot the interpolated head values against the velocity values