what bsxfun will perform here?

조회 수: 2 (최근 30일)
Shan Sha
Shan Sha 2018년 11월 13일
댓글: Star Strider 2018년 11월 13일
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?

채택된 답변

Star Strider
Star Strider 2018년 11월 13일
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
Shan Sha
Shan Sha 2018년 11월 13일
thanks sir
Star Strider
Star Strider 2018년 11월 13일
As always, my pleasure.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by