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 ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: I'm dense, but...somebody 'splain accumarray() please?
Posted: Jul 9, 2013 11:00 AM
  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 news:krf8cj$5kh$1@speranza.aioe.org...
> On 7/8/2013 10:42 AM, Steven_Lord wrote:
> ...
>

>> Have you used the accumulation behavior of SPARSE in the past?
>
> Nope; I've _rarely_ even used sparse as my problems generally didn't fit
> that space...
>
> Thanks for the notes, Steven; I'll study them at length and maybe the
> lightbulb will come on.


If it helps, think of ACCUMARRAY as sort of a "binning" tool like HIST. All
the values with the same row of indices in subs get shoved into the same bin
and then each bin gets processed into a scalar.

> BTW, I'm beginning to get mind around accumarray, cellfun, bsxfun and
> friends but they're all also new toys w/ the release 2012b that didn't
> have access to before. Plus, of course, anonymous functions and all that
> entails... :) And, since day job is farming and this is just playing, the
> amount of time to really devote isn't great...


If you've used inline functions, anonymous functions are at their most basic
similar: a way to write one expression as a function without requiring you
to create a separate function file or subfunction. However I feel anonymous
functions are more flexible and more powerful, in particular when it comes
to composition.

f = @(x) x.^2; % square x
g = @(x) sin(x)+cos(x);
h = @(x) g(f(x)); % sin(x.^2)+cos(x.^2)
h(0:5)

To do that with inline functions would be more complicated and the calling
syntax would be much less simple. [*]

> It does seem to me that the amount of basic explanatory text in relation
> to the specific syntax has dropped significantly w/ the new help
> documentation combined w/ the explosion in functionality. It seems like
> the "Getting Started" documentation could/(should?) probably grow by order
> of magnitude for such features.


It's a balancing act. If the table of contents for the "Getting Started"
documentation looks like the TOC for War and Peace, it would be intimidating
for new users. In addition, ACCUMARRAY is not exactly what I would call an
introductory function. I think few people will jump right in and start using
ACCUMARRAY their first day.

I think the mental model for the documentation staff for "Getting Started"
is what do new users need in order to get them started using MATLAB. As I
look at Getting Started now, all of the topics seem like things that a new
user may need to do in their first week of using MATLAB. The basics of
working with the Desktop? Sure, absolutely. Matrices and Arrays? Can't do
much in MATLAB without them. Indexing? Ditto.

Maybe we need an "Intermediate MATLAB Programming" documentation section
that discusses some of the more advanced topics, like matrix
creation/manipulation with BSXFUN, ACCUMARRAY, etc.? What do others think?

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

[*]
f2 = inline('x.^2', 'x');
g2 = inline('sin(x)+cos(x)', 'x');
h2 = inline('g(f(x))', 'x', 'f', 'g'); % Note h2 must accept three inputs,
not one like h did
h2(0:5, f2, g2)




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.