Adding certain 'parts' of two matrices

3 Ansichten (letzte 30 Tage)
Cheng Chang
Cheng Chang am 17 Apr. 2019
Bearbeitet: Stephen23 am 17 Apr. 2019
Hi guys,
I have two matrices:
A=[1 2;
3 4]
and
B=[0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0]
now I want to add matrix A to the second and third rows and columns of matrix B, so it becoms:
C=[0 0 0 0;
0 1 2 0;
0 3 4 0;
0 0 0 0]
How can I do that?
Thank you all guys.

Akzeptierte Antwort

Stephen23
Stephen23 am 17 Apr. 2019
Bearbeitet: Stephen23 am 17 Apr. 2019
B(2:3,2:3) = A

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by