Path: news.mathworks.com!not-for-mail
From: "Steven_Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: coping with "no indexing of function calls"
Date: Fri, 31 May 2013 09:55:07 -0400
Organization: MathWorks
Lines: 29
Message-ID: <koaa3r$nbm$1@newscl01ah.mathworks.com>
References: <ko7tn0$5n$1@reader1.panix.com> <ko83qf$4fo$1@newscl01ah.mathworks.com> <ko8b4g$ojc$1@reader1.panix.com>
NNTP-Posting-Host: ah-slord.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="iso-8859-1";
	reply-type=original
Content-Transfer-Encoding: 7bit
X-Trace: newscl01ah.mathworks.com 1370008507 23926 172.28.9.169 (31 May 2013 13:55:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 31 May 2013 13:55:07 +0000 (UTC)
In-Reply-To: <ko8b4g$ojc$1@reader1.panix.com>
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Xref: news.mathworks.com comp.soft-sys.matlab:796482



"kj" <no.email@please.post> wrote in message 
news:ko8b4g$ojc$1@reader1.panix.com...
> In <ko83qf$4fo$1@newscl01ah.mathworks.com> "Steven_Lord" 
> <slord@mathworks.com> writes:

*snip*

>>You could write a function that accepts the temporary output from the
>>function and the indices and extract just those elements of the temporary
>>output.
>
>>extractCertainElementsFromOneOutputFunction = @(tmp, index) tmp(index);
>>A = extractCertainElementsFromOneOutputFunction(foo(B), 1)
>
> I really like this idea.  In fact, I don't see why it has to be a
> temporary function.

It doesn't have to be. I wrote it as an anonymous function because it was 
less typing than defining a "named" function, although the fact that I used 
a 43 character variable name probably negated that advantage ;)

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com