How to apply bsxfun for floating point matrices
조회 수: 3 (최근 30일)
이전 댓글 표시
I have 2 floating point matrices.
How can i multiply corresponding entries in the matrices using bsxfun ?
Does bsxfun only work with numeric matrices ?
댓글 수: 1
Stephen23
2015년 1월 11일
편집: Stephen23
2015년 1월 11일
According to the documentation floating point arrays are a numeric data type . And bsxfun is certainly able to use floating point arrays.
Can you please post a comment with the complete code and error message.
If the two matrices are the same size (or one is a scalar), then you do not need to use bsxfun, you can simply use normal multiplication :
A.*B
답변 (1개)
Matt J
2015년 1월 11일
편집: Matt J
2015년 1월 11일
bsxfun works with both numeric and logical matrices. However, if the matrices are the same size, you should just do C=A.*B. If they are not the same size, then the syntax is
C=bsxfun(@times,A,B);
but you need to be sure the dimensions that disagree are singletons in one of the matrices.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!