Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: function witch varargout using feval for calling another function
Replies: 1   Last Post: Jan 13, 2009 8:46 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
John

Posts: 17
Registered: 7/8/07
function witch varargout using feval for calling another function
Posted: Jan 13, 2009 7:46 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello, I would like to ask you for help. Here is example what i want to do:

function x = f1(b)
x = b;
end
function [x1,x2] = f1(b)
x1 = b;
x2 = b*b;
end
function varargout = fmain(b,fhandle)

varargout = feval(fhandle,b)

end
calling:

x =fmain(y,@f1)
[x1,x2] =fmain(y,@f2)

I know that i can do it using strings and function eval but i am looking for better solution. Thanks for help
I dont want to use eval



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.