フィルターのクリア

hi, I want to divide a matrix in 2 parts vertically

3 ビュー (過去 30 日間)
loukil sana
loukil sana 2016 年 1 月 13 日
コメント済み: loukil sana 2016 年 1 月 13 日
A=[1 2 0 4 1 6;
4 5 0 0 1 2;
0 1 4 7 1 5 ]
I want to have in result
B=[1 2 0 4;4 5 0 0;0 1 4 7]
==> dimension=[4 3] and
C=[1 6;1 2;1 5]
==> dimension=[4 2]
I tried the function mat2cell but it doesn't divise vertically... Then I want to disp(B, 'matrcie B); and disp(C, 'matrice C)... HOW CAN I DO THIS PLEASE :)
  1 件のコメント
Stephen23
Stephen23 2016 年 1 月 13 日
編集済み: Stephen23 2016 年 1 月 13 日
Your dimensions do not make any sense, as the matrix only has three rows. Did you really mean [3,4] and [3,2] ?

サインインしてコメントする。

採用された回答

Stephen23
Stephen23 2016 年 1 月 13 日
編集済み: Stephen23 2016 年 1 月 13 日
>> B = A(:,1:4)
B =
1 2 0 4
4 5 0 0
0 1 4 7
>> C = A(:,5:end)
C =
1 6
1 2
1 5
Or of you want to use mat2cell:
>> D = mat2cell(A,3,[4,2]);
>> D{:}
ans =
1 2 0 4
4 5 0 0
0 1 4 7
ans =
1 6
1 2
1 5

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by