A very simple question about a column vector creation
조회 수: 3 (최근 30일)
이전 댓글 표시
I am an extra beginner MATLAB user. There is a 1:m command to create a 1 2 .... m row matrix. However, I couldn't find how to create a column vector as 12: 13-m. I mean (assume m=5):
12
11
10
9
8
댓글 수: 0
채택된 답변
Star Strider
2016년 7월 9일
If you want to decrement a vector, begin with the highest number and increment by a negative value to the desired end value. Here, the decrement value is -1:
m = 5;
v = [12: -1: m]'
v =
12
11
10
9
8
7
6
5
Is this what you want to do?
댓글 수: 2
Star Strider
2016년 7월 9일
My pleasure.
My apologies for the inaccurate code. I misunderstood your Question.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!