45
loading...
This website collects cookies to deliver better user experience
a=[ ]
b=[ ]
c=[a;b]
Note, For horizontal Concatenation, the number of rows for both matrices must be the same, and for vertical concatenation, the number of columns must be equal. If this rule is violated, Concatenation error is generated.
>> I=eye(10)
I =
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 1
>> z=zeros(3)
z =
0 0 0
0 0 0
0 0 0
>> z=zeros(3,5)
z =
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
>> x=rand(5,6)
x =
0.8147 0.0975 0.1576 0.1419 0.6557 0.7577
0.9058 0.2785 0.9706 0.4218 0.0357 0.7431
0.1270 0.5469 0.9572 0.9157 0.8491 0.3922
0.9134 0.9575 0.4854 0.7922 0.9340 0.6555
0.6324 0.9649 0.8003 0.9595 0.6787 0.1712
>> x=ones(5,6)
x =
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
>> x=diag(1:7)
x =
1 0 0 0 0 0 0
0 2 0 0 0 0 0
0 0 3 0 0 0 0
0 0 0 4 0 0 0
0 0 0 0 5 0 0
0 0 0 0 0 6 0
0 0 0 0 0 0 7