what bsxfun will perform here?

1 visualización (últimos 30 días)
Shan Sha
Shan Sha el 13 de Nov. de 2018
Comentada: Star Strider el 13 de Nov. de 2018
function Ccode = gen_binary_codes(C, K)
U=mean(C,1);
Ccode =zeros(size(C));
Ccode( bsxfun(@gt, C, K*U) )=1;
This is my code. what bsxfun is performing here?

Respuesta aceptada

Star Strider
Star Strider el 13 de Nov. de 2018
The bsxfun call calculates a vector of logical elements.
If ‘C’ is greater than ‘K*U’, the output is true, and the expression sets the elements of ‘Ccode’ corresponding to those logical true subscripts equal to 1.
  2 comentarios
Shan Sha
Shan Sha el 13 de Nov. de 2018
thanks sir
Star Strider
Star Strider el 13 de Nov. de 2018
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by