Sunday, 31 July 2016

MATLAB Programming 41 - Some vector operations (6) (Example)

Example


Create a script file with the following code:


r1 = [ 1 2 3 4 ];
r2 = [5 6 7 8 ];
r = [r1,r2]
rMat = [r1;r2]
c1 = [ 1; 2; 3; 4 ];
c2 = [5; 6; 7; 8 ];
c = [c1; c2]
cMat = [c1,c2]

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


r =
1 2 3 4 5 6 7 8

rMat =
1 2 3 4
5 6 7 8

c =
1
2
3
4
5
6
7
8

cMat =
1 5
2 6
3 7
4 8


No comments:

Post a Comment