merging two matrix into a single one
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I have two matrices.
j =
1 2 3
0 0 0
0 0 0
k =
0 0 0
0 0 0
4 1 7
I need the following matrix
l =
1 2 3
0 0 0
4 1 7
How to do that? Thanks
0 commentaires
Réponse acceptée
Matt Fig
le 15 Juin 2011
J = [1 2 3;0 0 0;0 0 0];
K = [0 0 0;0 0 0;4 1 7];
L = max(J,K)
0 commentaires
Plus de réponses (1)
Walter Roberson
le 15 Juin 2011
J = [1 2 3;0 0 0;0 0 0];
K = [0 0 0;0 0 0;4 1 7];
L = J + K;
or
L = J; L(K<>0) = K(K<>0);
5 commentaires
Walter Roberson
le 15 Juin 2011
Oops... the symbolics use <> and I've been answering questions about those again.
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!