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 ExchangeData 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