MATLAB Answers

How to define a sequence that goes two directions

조회 수: 2(최근 30일)
Abid Manzar
Abid Manzar 2021년 9월 15일
댓글: Abid Manzar 2021년 9월 16일
I have to write a Program that, among other things, defines a matrix and asks me to, in one line, assign the values, 12 6 0 -6 -12 12 18 24 30 36, to one row. I was thinking I should use the "x:1:y" type of command but I don't know how to make it go two directions in one command.

채택된 답변

Adam Danz
Adam Danz 2021년 9월 15일
[12:-6:-12, 12:6:36]
ans = 1×10
12 6 0 -6 -12 12 18 24 30 36
  댓글 수: 3
Abid Manzar
Abid Manzar 2021년 9월 16일
For sure! I only started learning Matlab this semester and everything is new to me.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by