Column Vectors in MATLAB Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report Column vectors are vectors that have a single column but, multiple rows. MATLAB provides various functions that use column vectors as their arguments. In this article, we will see different methods of creating and using column vectors in MATLAB. Creating Column Vectors:Method 1:The simplest way of creating column vectors in MATLAB is by using the ';' separator. See the example below. Example 1: Matlab % MATLAB Create Column Vectors vec = [1;2;3;4;5] Output: This will create a column vector with 5 rows. Method 2:A column vector is the transpose of a row vector so, we can convert a row vector into a column vector by taking its transpose. Example 2: Matlab % MATLAB code for creating a row vector vec = 3:13; % Displaying the row vector disp(vec) % Computing the transpose of vec vec = vec'; % Displaying the transpose of row vector vec disp("Transpose of row vector is:") disp(vec) Output: Uses of Column Vectors:One of the uses of column vectors is for multiplying row vectors. Consider the case when we are given two row vectors and we need to find their product. Since they are both row vectors, it is impossible to calculate their product as their dimensions are not compatible. So, we would change one of them to a column vector and then we can compute their product. Example 3: Matlab % MATLAB Code for % Two row vectors vecA = 1:8; vecB = 5:12; % Converting vecB into a column vector vecB = vecB'; % Calculating the product of column % vector vecB and row vector vecA prod = vecB*vecA; disp(prod) Output: Comment More infoAdvertise with us Next Article How to remove decimal in MATLAB? O owl0223 Follow Improve Article Tags : Software Engineering MATLAB-Maths Similar Reads Turn an Array into a Column Vector in MATLAB Conversion of an Array into a Column Vector. This conversion can be done using a(:) operation. A(:) reshapes all elements of A into a single column vector. This has no effect if A is already a column vector. Example 1 Matlab % MATLAB code for Conversion of an array % into a column vector a = [2 4 6 1 min read Text Formatting in MATLAB In the real-world data can be any form. This data may be in binary, numeric, text, array, and so on. And this data can be converted into text. In Matlab, the text can be formatted using a formatting operator along with formatting functions such as sprintf, numstr, fprintf, compose. These functions/o 4 min read Create Matrix from Vectors in R In this article, we will discuss How to convert a vector to a matrix in R Programming Language. A vector is a basic object that consists of homogeneous elements. The data type of vector can be integer, double, character, logical, complex, or raw. A vector can be created by using the c() function. Sy 6 min read How to remove decimal in MATLAB? In this article, we are going to discuss the "Removal of decimal point" in MATLAB which can be done using sprintf(), fix(), floor(), round() and num2str() functions which are illustrated below. Using sprintf() The sprintf() function is used to write formatted data to a string. Syntax: sprintf(format 3 min read Tables in MATLAB Table is an array data type in MATLAB that stores column-based or tabular data of same or different types. A table stores each column-oriented data under a variable name (column name). These table columns can have different data types in each however, the number of data points in every column must b 2 min read Trigonometric Functions in MATLAB In this article, we are going to discuss trigonometric functions and their types in MATLAB. Trigonometric functions are the mathematical functions that can result in the output with the given input. There are six trigonometric functions - Sine (sin)Cosine(cos)Tangent(tan)CoTangent(cot)Secant(sec)Co 5 min read Like