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

106 次查看(过去 30 天)
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 中查找有关 Loops and Conditional Statements 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by