MATLAB Answers

Creating an array from 1 to n

조회 수: 251(최근 30일)
Hello!
I am trying to create an array of integers from 1 to n [1 2 3 ..... n], where n is a variable that can change.
How should I approach that?
Thank you!

  댓글 수: 1

Guillaume
Guillaume 20 Dec 2019
This is such an elementary concept in matlab that I would recommend that you go through the free Matlab Onramp and the getting started tutorial in the doc to learn the basics of matlab.

로그인 to comment.

채택된 답변

Alex Mcaulley
Alex Mcaulley 20 Dec 2019
n = 10 %
1:n
ans =
1 2 3 4 5 6 7 8 9 10

  댓글 수: 0

로그인 to comment.

추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by