MATLAB vectors are used in many situations, e.g., creating x-y plots, that do not fall under the rubric of linear algebra. In these contexts a vector is just a convenient data structure. MATLAB still enforces the rules of linear algebra so paying attention to the details of vector creation and manipulation is always important. To create a vector with one of these functions you must (atleast initially) decide how long do you want the vector to be. You must also decide whether the vector is a row or column vector. The ones and zeros functions have two arguments. The first is the number of rows in the matrix you wish to create. The second is the number of columns. To create a row or a column vector set the appropriate argument of ones and zeros to one. The linspace and logspace functions create vectors with linearly spaced or logarithmically spaced elements, respectively. Here are examples including the MATLAB output. Automatic augmentation of vectors does not allow you to refer to elements that have not yet been allocated. Using colon notation to create a vector requires you to specify the increment, whereas using the linspace command requires you to specify the total number of elements. The following commands show how to create the same vector with both approaches. When a colon expression appears in place of a vector (or matrix) index, the expression is a kind of implied do loop. The expression Source.