Subtraction of alternate cells in an array

1 回表示 (過去 30 日間)
Sandeep Nair
Sandeep Nair 2021 年 4 月 28 日
コメント済み: Matt J 2021 年 4 月 28 日
I have an array of lets say A=[ 1 2 3 4 5 6 7 8 9 10]' and now i want to do a subtraction of the numbers by leaving once cell in btw like [3-1 4-2 5-3 6-4 7-5 8-6 9-7 10-8]
I can do this in loop but i dont know how to do it with matlabs powerful vectorisation operations
  1 件のコメント
Matt J
Matt J 2021 年 4 月 28 日
Beware confusing readers with the terminology "cell" !

サインインしてコメントする。

採用された回答

Matt J
Matt J 2021 年 4 月 28 日
A(3:end)-A(1:end-2)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by