check the row that has at least one non zero element, except one row
Mostrar comentarios más antiguos
I have a matrix that has 20 rows and I have to calculate some thing only on the rows that have at least one element, except one row that is specified by a variable, I use this:
for i = setdiff(1:r, row)
for the specific row exception part, but how can i mix this with, for example, any(matrix,2)?
2 comentarios
Bob Thompson
el 12 de Feb. de 2018
I'm a little confused what you're asking. Are you looking for how to code the check for non-zero elements in each row?
negin tebyani
el 12 de Feb. de 2018
Respuestas (1)
Stephen23
el 12 de Feb. de 2018
idx = setdiff(1:r, row)
any(matrix(idx,:),2)
4 comentarios
negin tebyani
el 12 de Feb. de 2018
Interference = zeros(r,c);
for idr = 1:r
idx = setdiff(1:r, idr);
for idc = 1:c
Interference(idr,idc) = ChannelGainUN(idx,idc)/MaxBandwidthOfEachRRH(idx);
end
end
negin tebyani
el 12 de Feb. de 2018
Editada: negin tebyani
el 12 de Feb. de 2018
Stephen23
el 13 de Feb. de 2018
for idr = 1:r
idx = setdiff(1:r, idr);
any(matrix(idx,:),2)
end
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!