フィルターのクリア

Matrix manipulation problem under MATLAB

1 回表示 (過去 30 日間)
dakhli mohamed
dakhli mohamed 2018 年 11 月 21 日
回答済み: Guillaume 2018 年 11 月 21 日
I want to put a matrix A in another matrix B
example
A= 0 2 9
5 7 3
4 6 1
B= 0 2 9 0 0 0
5 7 3 0 0 0
4 6 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
and a C matrix in another place
C= 1 2 3
4 5 6
7 8 9
B= 0 2 9 0 0 0
5 7 3 0 0 0
4 6 1 0 0 0
0 0 0 1 2 3
0 0 0 4 5 6
0 0 0 7 8 9

採用された回答

Adam
Adam 2018 年 11 月 21 日
編集済み: Adam 2018 年 11 月 21 日
A = [0 2 9; 5 7 3; 4 6 1];
C = [1 2 3; 4 5 6; 7 8 9];
B = zeros(6);
B(1:3,1:3) = A;
B(4:6,4:6) = C;
  2 件のコメント
dakhli mohamed
dakhli mohamed 2018 年 11 月 21 日
I want to redo the same work but with a matrix of size 284 * 284
what should I do
Adam
Adam 2018 年 11 月 21 日
Just extend it in the obvious way based on whatever you want to insert.

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

その他の回答 (1 件)

Guillaume
Guillaume 2018 年 11 月 21 日
Possibly, you're looking for blkdiag:
A = [0 2 9; 5 7 3; 4 6 1];
C = [1 2 3; 4 5 6; 7 8 9];
B = blkdiag(A, C)

カテゴリ

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