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

5 Ansichten (letzte 30 Tage)
a = [1 2 3 ;
4 5 6 ;
7 8 9]
b = [7 5 6]
c = [19 23;
31 29;
17 13]
  3 Kommentare

Melden Sie sich an, um zu kommentieren.

Antworten (1)

William Rose
William Rose am 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.

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by