MATLAB - Transpose of a Vector



The transpose operation changes a column vector into a row vector and vice versa. The transpose operation is represented by a single quote (').

Example

Create a script file with the following code −

r = [ 1 2 3 4 ];
tr = r';
v = [1;2;3;4];
tv = v';
disp(tr); disp(tv);

When you run the file, it displays the following result −

   1
   2
   3
   4

   1     2     3     4
matlab_vectors.htm
Advertisements