generating a sequence 1,2,3,4,....,n

조회 수: 128 (최근 30일)
Rabeya
Rabeya 2012년 4월 21일
답변: Arsal noor 2020년 10월 22일
Without using a for loop, how can I generate an index 1,2,3,...,n?

채택된 답변

R.U.F.
R.U.F. 2012년 4월 21일
vector=[1:stepsize:n] if the stepsize =1 as in your case, you can disregard it
  댓글 수: 1
Jan
Jan 2012년 4월 22일
Following the mlint suggestion, you can omit the square brackets: "1:n"

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

추가 답변 (1개)

Arsal noor
Arsal noor 2020년 10월 22일
X = [1 2 3 4]

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by