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

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

 採用された回答

R.U.F.
R.U.F. 2012 年 4 月 21 日

1 投票

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 日

1 投票

X = [1 2 3 4]

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

製品

タグ

質問済み:

2012 年 4 月 21 日

回答済み:

2020 年 10 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by