How to Subtract two rows of same matrix?
    7 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    baruch
 le 23 Août 2014
  
    
    
    
    
    Modifié(e) : Matz Johansson Bergström
      
 le 23 Août 2014
             I have a matrix A=[2 3;5 6] and then I have another matrix A1=[3 4 5;6 7 8;0 0 1].I want to subtract 2nd row from first row of Matrix A and after that I want to insert it into second row of matrix A1 ,then how can I do that?
0 commentaires
Réponse acceptée
  Matz Johansson Bergström
      
 le 23 Août 2014
        
      Modifié(e) : Matz Johansson Bergström
      
 le 23 Août 2014
  
      tmp = A(1,:)-A(2,:)
But A1 is a 3x3 matrix and not like A which is a 2x2, so how do you want to insert the elements?
We could do it either
A1(2, 1:2)=tmp
or
A1(2, 2:3)=tmp
In the above expressions you may substitute tmp and write A(1,:)-A(2,:) directly if you wish.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Creating and Concatenating Matrices 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!

