Technical discussion about Matlab and issues related to Digital Signal Processing.
Dear all, I have a question about how to call a function as an argument of another function. For example, first I have "fun1" as function a=fun1(x,y) a=x*y; then, I want to write "fun2" which calls "fun1" as an argument as fun2(x,y,fun1); function a=fun2(x,y,f) a=f(x,y); Apparently, above codes do not work. So how could I write "fun2" correctly?? Thanks in advance!! Best, Xiaoxia Ye
| Hi
Xiaoxia Run the following code and see the results, I hope it will solve your problem. function a = main() x = 3; y = 4; a2 = func2(x,y,fun1( disp(a2); end function b = func2(x,y,f) b = x+y+f; end function a = fun1(x,y) a = x*y; end Mudasser --- On Sun, 3/23/08, Ye, Xiaoxia <wisesummerye@ From: Ye, Xiaoxia <wisesummerye@ |