Path: news.mathworks.com!not-for-mail
From: "Matthias " <matthias.is.at.the.domain.@hoffacker.remove.this.net>
Newsgroups: comp.soft-sys.matlab
Subject: Multiple Anonymous Functions
Date: Tue, 3 Nov 2009 15:55:19 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <hcpjp7$o4k$1@fred.mathworks.com>
Reply-To: "Matthias " <matthias.is.at.the.domain.@hoffacker.remove.this.net>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257263719 24724 172.30.248.38 (3 Nov 2009 15:55:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 3 Nov 2009 15:55:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 540943
Xref: news.mathworks.com comp.soft-sys.matlab:582075


Hello,

in the Matlab Help there is an Example for Multiple Anonymous Functions:

g = @(c)  (quad(@(x) (x.^2 + c*x + 1), 0, 1))

g(2)
ans =
   2.3333

This works fine. I'd like to be able to call this function with an array of parameters:
g([1,2,3]) 
ans = 
   [g(1), g(2), g(3)] 

I do not want to use external m-files and for-loops. Is there any way?

Regards,
Matthias