I have a function myfunc(x,y,L,P) designed to take x,y coordinates and additional parameters L(11x2 double) and P(36x1 double). When I test the function, it works properly. When I try to repeat the calculation using a vector of coordinates, arrayfun and an anonymous function, it fails. Hopefully the code snippet below is enough for someone to help me diagnose.
x = 10;
y = 1;
Test1 = myfunc(x,y,L,P); % Works!
f = @(x,y)myfunc(x,y,L,P)
Test2 = f(x,y) % Works - matches above!
a = ones(5,1)*x;
b = ones(5,1)*y;
Test3 = arrayfun(@f,a,b) % Unrecognized function or variable 'f'

 채택된 답변

Torsten
Torsten 2024년 7월 4일

0 개 추천

Test3 = arrayfun(f,a,b)
instead of
Test3 = arrayfun(@f,a,b)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Guidance, Navigation, and Control (GNC)에 대해 자세히 알아보기

제품

릴리스

R2024a

질문:

2024년 7월 4일

댓글:

2024년 7월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by