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

Without using a for loop, how can I generate an index 1,2,3,...,n?

 Accepted Answer

R.U.F.
R.U.F. on 21 Apr 2012
vector=[1:stepsize:n] if the stepsize =1 as in your case, you can disregard it

1 Comment

Following the mlint suggestion, you can omit the square brackets: "1:n"

Sign in to comment.

More Answers (1)

Products

Tags

Asked:

on 21 Apr 2012

Answered:

on 22 Oct 2020

Community Treasure Hunt

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

Start Hunting!