what bsxfun will perform here?

2 Ansichten (letzte 30 Tage)
Shan Sha
Shan Sha am 13 Nov. 2018
Kommentiert: Star Strider am 13 Nov. 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?

Akzeptierte Antwort

Star Strider
Star Strider am 13 Nov. 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 Kommentare
Shan Sha
Shan Sha am 13 Nov. 2018
thanks sir
Star Strider
Star Strider am 13 Nov. 2018
As always, my pleasure.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by