match time stamps index
3 views (last 30 days)
Show older comments
michael scheinfeild
on 18 Jan 2021
Edited: Walter Roberson
on 25 Jan 2021
hi i have two vectors diffrent lengths with diffrent values
i want to match closest index in one vector to other
example :
v1 =
[1610759986514 1610759986549 1610759986583 1610759986618 ]
v2= [ 1610759986540 1610759986589]
so result should be in vector 1 match index 2,3 to v2 index 1,2 (time is close enough)
0 Comments
Accepted Answer
Walter Roberson
on 18 Jan 2021
Edited: Walter Roberson
on 25 Jan 2021
format long g
v1 = [1610759986514 1610759986549 1610759986583 1610759986618 ]
v2 = [1610759986540 1610759986589]
interp1(v1, 1:length(v1), v2, 'nearest', 'extrap')
interp1(v2, 1:length(v2), v1, 'nearest', 'extrap')
0 Comments
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!