Replace elements in a SxS matrix with zero, in each column but in different rows
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Miroslav Josic
el 1 de Feb. de 2017
Comentada: Miroslav Josic
el 2 de Feb. de 2017
Hi people,
I know how to simply replace elements with zero, but I'm stuck with this problem. I have a matrix 2108x62 and I need to replace elements in column #1 and row 1-34 by zero, then in column #2 but row 35-68, then column #3 but row 69-102 etc to the end of column 62 and row 2075-2108.
Best,
Miroslav
0 comentarios
Más respuestas (1)
David J. Mack
el 1 de Feb. de 2017
Editada: David J. Mack
el 1 de Feb. de 2017
Hey Miroslav,
% Let M be your 2108*64 matrix.
iRow=(1:2108)'; %Row indicesin i-j notation
jCol=floor(iRow/34)+1; %Column indices using DIV in i-j notation
ind=sub2ind([2108 62],iRow,jCol); %Linear indices (e.g. 1,1 = 1; n,m=n*m)
M(ind)=0;
Greetings, David
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!