フィルターのクリア

How to create a vector of this output?

2 ビュー (過去 30 日間)
Kash Costello
Kash Costello 2018 年 11 月 29 日
コメント済み: Star Strider 2018 年 11 月 29 日
Hi!
Can anyone tell me how to do this in matlab? I've tried using 3 for loops but I am getting the wrong answer. My range is from -2 to 2.
Here is what I want to get:
... and so on and so forth.
Thanks a lot!

採用された回答

Star Strider
Star Strider 2018 年 11 月 29 日
Try this:
[X,Y,Z] = ndgrid(-2:2);
Out = [Z(:),Y(:),X(:)]
producing:
Out =
-2 -2 -2
-2 -2 -1
-2 -2 0
-2 -2 1
-2 -2 2
-2 -1 -2
-2 -1 -1
-2 -1 0
-2 -1 1
-2 -1 2
-2 0 -2
-2 0 -1
-2 0 0
-2 0 1
-2 0 2
etc.
  2 件のコメント
Kash Costello
Kash Costello 2018 年 11 月 29 日
THANK YOU <3
Star Strider
Star Strider 2018 年 11 月 29 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by