Hi,
I have two sets of data taken simultaneously. Dataset A includes a time vector, and a corresponding matrix of lat/lon values taken at those times. Dataset B has a different time vector, and corresponding reflectance data.
I want to link the lat/lon from Dataset A to the reflectance data from Dataset B Since I have time for both datasets, I was thinking I could interpolate the lat/lon values from Dataset A to new lat/lon values that match the Dataset B time, but am struggling. Does anyone know how to do this?
I tried:
B_lat= interp1(A_time, A_lat, B_time);
But I get the error "Sample points must be unique and sorted in ascending order," which makes sense because the latitude vector doubles back on itself occasionally.
I also tried:
[B_lat,B_lon] = interpm(A_lat,A_lon,0.0001);
Which works, but then the issue is that I'm just getting a new, larger vector to match to Dataset B.
Also, just for context, originally I was just finding the closest times in A and B and matching the lat/lon and reflectance data that way, but then I realized that means that sometimes I end up with the same lat/lon for different data points. The data was taken on a boat, and I'm comfortable with the interpolation just being linear.
Thanks in advanced for the help! If I've left off any information please let me know.