Path: news.mathworks.com!not-for-mail
From: "Nick Denman" <ngdenmanNOSPAM@gmail.REMOVETHIS.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: input problems: beginner in matlab
Date: Tue, 18 Sep 2007 03:02:33 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <fcnf49$82m$1@fred.mathworks.com>
References: <fcmp9t$3vj$1@fred.mathworks.com>
Reply-To: "Nick Denman" <ngdenmanNOSPAM@gmail.REMOVETHIS.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1190084553 8278 172.30.248.37 (18 Sep 2007 03:02:33 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 18 Sep 2007 03:02:33 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 745609
Xref: news.mathworks.com comp.soft-sys.matlab:429027



Hi Eddy

"Eddy " <grotehaas@mathworks.com> wrote in message 
<fcmp9t$3vj$1@fred.mathworks.com>...
> x=[1:1:10]
> fprintf('please enter a function like sin cos exp 
etc,\n')
> fprintf('the calculation performed will be like
> pfun(funct(x)),\n')
> fprintf('where funct is your function and x= 0 to 10
> increment with 1,\n')
> funct=input('function funct=','s')
> pfun=funct'(x)'

help str2func

E.g.
x = 1:10;
str = 'sin';
fcn = str2func(str);
fcn(x)

--
Nick