Matlab: Create function with another function as argument -


i need create function f function, g, argument (g defined in .m file, not inline). in body of f, need use feval evaluate g on multiple values; like:

function y = f(a,b,c,g)  z=feval(g,a,b,c);  y=... end 

what syntax ? tried use handles, got error messages.

you can way:

  1. define f in m-file:

    function y = f(a,b,c,g)     y = feval(g,a,b,c); end 
  2. define g in m-file:

    function r = g(a,b,c)     r = a+b*c; end 
  3. call f handle g:

    >> f(1,2,3,@g) ans =      7 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -