>> test1=[1,2;3,4]
test1 =
1 2
3 4
>> test2=[5,6;7,8]
test2 =
5 6
7 8
>> test3=[test1,test2]
test3 =
1 2 5 6
3 4 7 8
>> test4=[test1;test2]
test4 =
1 2
3 4
5 6
7 8
===
對于維數相同的矩陣
cat(1,A,B)相當于[A;B]
cat (2, A, B) 相當于[A,B]
cat (3, A, B) 相當于增加維度
當A,B分別為二維矩陣時,合并之后為三維矩陣;A,B為三維矩陣,則在第三維方向上合并A,B。>> cat(1,test1,test2)
ans =
1 2
3 4
5 6
7 8
>> cat(2,test1,test2)
ans =
1 2 5 6
3 4 7 8
>> cat(3,test1,test2)
ans(:,:,1) =
1 2
3 4
ans(:,:,2) =
5 6
7 8
posted on 2012-10-27 12:31
luis 閱讀(4219)
評論(0) 編輯 收藏 引用 所屬分類:
Matlab