# Plot of head against velocity data based on timestamp similarity

2 views (last 30 days)
muhammad choudhry on 10 Mar 2022
Commented: Jon on 10 Mar 2022
Hi,
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';
x=a(:,1);
y=a(:,2);
x=a(:,1);
y=a(:,2);

Jon on 10 Mar 2022
Edited: Jon on 10 Mar 2022
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
plot(u,hq)
Jon on 10 Mar 2022
Great, good luck with your experiment.