Problem with bsxfun and custom function
이전 댓글 표시
I am trying to apply elementwise a custom 'division' function.
Here is an example
A = rand(4)
B = randn(5)
bsxfun(na_div,A,B)
with
function[out] = na_div(x,y);
if isnan(x) & ~isnan(y)
out = 1/y;
elseif ~isnan(x) & isnan(y)
out = x;
else
out = x/y;
end
I get the following error message: 'Not enough input arguments'.
The function works properly when applied to two numbers. Any idea why? Or any other solution to get the same result?
Thanks
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!