Vector Difference

Given a vector x=[2 5 6 10 16 29].
Is there a one line command to create another vector that is the difference between the last elements (first element of x is first element of y)?
Example Output: y=[2 3 1 4 6 13]

 채택된 답변

David Young
David Young 2011년 11월 24일

0 개 추천

y = [x(1) diff(x)]

댓글 수: 1

Mark
Mark 2011년 11월 24일
I appreciate the quick response. Excellant. Thankyou.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

질문:

2011년 11월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by