First number that comes after a list of numbers

조회 수: 2 (최근 30일)
Jonathan Cheong
Jonathan Cheong 2021년 3월 8일
댓글: Jonathan Cheong 2021년 3월 8일
Hello, I have a list of numbers 'indexstart'. I would like to find the 1st number that comes after these number from another list 'indend' and append them both in different columns.
For example:
A = [1, 8, 20]
B = [4, 5, 6, 9, 25, 30]
The output would be:
[1, 4]
[8, 9]
[20, 25]
Thanks in advance.

채택된 답변

dpb
dpb 2021년 3월 8일
>> [A;interp1([-eps(1) B],[-eps(1) B],A,'next')].'
ans =
1 4
8 9
20 25
>>

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Downloads에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by