quick beginner MATLAB question.
How do I create a 1 by N matrix with elements going from 1 to N?
Ex. [1 2 3 4 ..... N]
thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just do
The brackets are optional.
There is also another option if you want to change the increment to something other than
1. The general pattern isSo if you want only even numbers from 2 to 100, you can do
Or if you want to get numbers from 1 to 0 decrementing by .1 you can do
I highly recommend you take a quick squiz through the Matlab Getting Started Guide. It covers the basics such as this.