Sunday, 31 July 2016

MATLAB Programming 41 - Some vector operations (5)

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


No comments:

Post a Comment