How to add a selection of elements from one matrix to a selection of elements of another matrix?
    7 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Laura Albers
 am 1 Mai 2018
  
    
    
    
    
    Beantwortet: Siyu Guo
      
 am 1 Mai 2018
            Hello,
I have two matrices:
- Y, which is a 2462x220 matrix
 - Y_dif, which has the same dimensions
 
Basicaly, I want to add a submatrix within Y_dif to a submatrix of Y. More specifically: For rows 505:560 and columns 46:50 in matrix Y I want to add element-wise the values in row 393:448 and columns 48:50 of matrix Y_dif.
Does someone know how to do this?
0 Kommentare
Akzeptierte Antwort
  Siyu Guo
      
 am 1 Mai 2018
        The sub-matrix in Y_dif is 56-by-3 and the destination sub-matrix in Y is 56-by-5. The sizes do not match, and the addition cannot be done. If the column 48:50 in Y_dif is a typo of 46:50, then simply: Y(505:560, 46:50) = Y(505:560, 46:50) + Y_dif(393:448, 46:50);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!