How to overcome the data length issue in the following code?
Show older comments
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 find the similar or the nearest Timestamps in the Head_Timestamps.xlsx hence on matching plot the corresponding data (head/Uy) hence save the timestamp, head, and Uy into new xlsx or csv file. I have tried the intern1 function so far in which I am having problem because in file Head_Timestamps.xlsx there are more data then the TimeStamps_Uy.xlsx. I am pasting the code and error below?
Code:
close all; clear all; clc;
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);
time_stamp_u=a(:,1);
u=a(:,2);
Head_dir = 'F:\3-PIV_Experimental_Data\Outlet_110\Data_LaserSheet_D\Data_Head\Data_Raw\Head_Timestamps.xlsx';
a1 = readmatrix(Head_dir);
time_stamp_h=a1(:,1);
h=a1(:,2);
h_u = interp1(h,u,time_stamp_u)
Error:
Error using interp1>reshapeAndSortXandV (line 445)
X and V must be of the same length.
Error in interp1 (line 128)
[X,V,orig_size_v] = reshapeAndSortXandV(X,V);
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets 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!