# i have 3 matrices the first one is 3x3 the second is 1x3 the third is 3x2 and i want to build new matrix using the 1st raw of the 1st and the second row of 2nd he 2nd

4 views (last 30 days)
fatima haydar ahmad on 17 Apr 2022
Answered: William Rose on 17 Apr 2022
a = [1 2 3 ;
4 5 6 ;
7 8 9]
b = [7 5 6]
c = [19 23;
31 29;
17 13]
DGM on 17 Apr 2022
How does the third matrix relate to any of this?

William Rose on 17 Apr 2022
You wrote: "i have 3 matrices the first one is 3x3 the second is 1x3 the third is 3x2 and i want to build new matrix using the 1st raw of the 1st and the second row of 2nd he 2nd"
However, the 2nd matrix only has 1 row, so I will assume you meant to write:
"using the first row of a, all of matrix b, and the second column of matrix c as the thrid row of the new matrix"
The code below shows how to do it. Adjust as desired to meet your actual wishes.
a = [1 2 3 ; 4 5 6 ; 7 8 9];
b = [7 5 6];
c = [19 23; 31 29; 17 13];
d=[a(1,:); b; c(:,2)']
d = 3×3
1 2 3 7 5 6 23 29 13
Try the above.

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by