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: dynamic anonymous function
Replies: 2   Last Post: Mar 9, 2012 9:28 AM

Advanced Search

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

Posts: 35
Registered: 2/4/08
Re: dynamic anonymous function
Posted: Mar 8, 2012 10:32 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi,

I was able to fix the problem this way

fn = @(x)eval(fnstr)

regards


"Balachander Narasimhan" <balxxxxxchand@whatever.com> wrote in message <jjbn2q$hj$1@newscl01ah.mathworks.com>...
> Hi,
>
> I know if we define fn = @(x)x*x, then fn(a) will give the squared value of a
>
> Now suppose I don't know the anonymous function x*x in advance, rather it is obtained out of a string manipulation operation and I have it in 'fnstr' which has 'x' in it
>
> I tried doing 'fn = @(x)fnstr' but it does not work.
>
> Kindly let me know how to do this




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.