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

118 visualizzazioni (ultimi 30 giorni)
Rabeya
Rabeya il 21 Apr 2012
Risposto: Arsal noor il 22 Ott 2020
Without using a for loop, how can I generate an index 1,2,3,...,n?

Risposta accettata

R.U.F.
R.U.F. il 21 Apr 2012
vector=[1:stepsize:n] if the stepsize =1 as in your case, you can disregard it
  1 Commento
Jan
Jan il 22 Apr 2012
Following the mlint suggestion, you can omit the square brackets: "1:n"

Accedi per commentare.

Più risposte (1)

Arsal noor
Arsal noor il 22 Ott 2020
X = [1 2 3 4]

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by