creating an interval from vector array
21 次查看(过去 30 天)
显示 更早的评论
I have for example a vector V = [1 2 3 4 5 6 7 8 9 10]'
I would like to create intervals in which each interval starts with the with the ending of the previous interval, Meaning interval 1: 1-2, interval 2: 2-3, interval 3: 3-4 and so on.
is there a certain command for that?
0 个评论
采纳的回答
更多回答(1 个)
Walter Roberson
2021-9-1
V = [1 2 3 4 5 6 7 8 9 10]'
intervals = buffer(V,2,1,'nodelay')
Now take the columns of intervals.
This requires the Signal Processing Toolbox.
... and is easy enough to create on your own:
intervals = [V(1:end-1), V(2:end)].'
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!