How to range array steps

65 ビュー (過去 30 日間)
Life is Wonderful
Life is Wonderful 2021 年 9 月 22 日
コメント済み: Life is Wonderful 2021 年 9 月 22 日
Hi
I am looking for a logic to range of value from -1 to +1 including 0 where data should look like
-1-2-3...-32 : +32+31..1
Example snippet
x = [-1:-1:-32:32:1:1]
x = 1×3
-1 0 1
Note : No Loops involed
Thank you

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 9 月 22 日
Split into two sequences:
x = [-1:-1:-32,32:-1:1];
HTH
  2 件のコメント
Life is Wonderful
Life is Wonderful 2021 年 9 月 22 日
x = [-1:-1:-32,32:-1:1]
x = 1×64
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30
0 is missing !!
Life is Wonderful
Life is Wonderful 2021 年 9 月 22 日
x = [0:-1:-32,32:-1:0]
x = 1×66
0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by