How to create a vector using for-end loops that contains odd integers between 1 and 100?

3 views (last 30 days)
Vector Q contains the odd integer between 1 and 100

Accepted Answer

Walter Roberson
Walter Roberson on 6 Oct 2016
Hint: for location Index, the value is (2*Index - 1)

More Answers (1)

Phyo Pie
Phyo Pie on 22 Oct 2020
Edited: Phyo Pie on 22 Oct 2020
Q = [1:2:99]
EDITED!!
1:2:99 is a vector already. The square brackets joins all elements to a vector. It does not change anything on the data, but needs more time.
Q = 1:2:99

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!