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: I'm dense, but...somebody 'splain accumarray() please?
Replies: 23   Last Post: Jul 11, 2013 1:00 PM

Advanced Search

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

Posts: 76
Registered: 2/11/09
Re: I'm dense, but...somebody 'splain accumarray() please?
Posted: Jul 10, 2013 3:22 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

dpb <none@non.net> wrote in message <krk9mr$5c5$1@speranza.aioe.org>...
> On 7/10/2013 1:22 PM, Eric Sampson wrote:
> ...
>

> > I must be being dense too ;) because didn't you already show in your
> > example that you can use the ~ operator to ignore return values, like
> > [~,~,c] = unique(a(:,3)); or am I misunderstanding your question?

>
> But I had to save c in order to pass it to the following invocation of
> arrayfun().
>
> It would be _a_good_thing_ since that's the only reason for c to not to
> have to create it in the workplace or local context an have it hanging
> around but rather to have it be a temporary by nesting the function calls.
>
> If it were u that were needed/wanted as the argument, then it could be done.
>
> Sometimes, if the function result is need more than once then it makes
> sense to make the temporary to avoid repeated evaluations, of course
> (there's where enhancing the optimizer comes in if it can recognize
> common expressions and eliminate the second call or not).
>
> That help, hopefully?
>
> --


Ah yes, I think that now I understand what you were referring to. Oddly enough, I submitted an enhancement request recently that you might like, to allow a person to do something like this:

lcontig=accumarray([~,~,c] = unique(a(:,3)),a(:,4),[],@(x) all(abs(diff(x))==1))

The temp variable can be named whatever you want, the crux of the enhancement request is to allow you to next function calls with multiple return arguments, as long as all but one return arg are ignored using ~.

If you like that idea, please email/call TMW support and let them know, so they add your vote to the enhancment request :)

Cheers


Date Subject Author
7/5/13
Read I'm dense, but...somebody 'splain accumarray() please?
dpb
7/5/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/6/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
james bejon
7/8/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
Steven Lord
7/8/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/9/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
Steven Lord
7/9/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
Marc
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
Kim Andrews
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
EBS
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
EBS
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
Kelly Kearney
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/11/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
Kelly Kearney
7/11/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
Kelly Kearney
7/10/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
dpb
7/11/13
Read Re: I'm dense, but...somebody 'splain accumarray() please?
Steven Lord

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.