Subtracting the next element on a vector? Basic
古いコメントを表示
If I have a vector with n elements, and want a new vector with the subtraction of the first by the second element, and continues...
For exemple: A = [20, 8, 4, 1] turns into B = [(20-8),(8-4),(4,1)]
I started something with
n = length(A);
for k = 1:n
....
but nothing I tried worked them.
Thanks.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Environment and Settings についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!