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: sorting arrays in a cell array
Replies: 23   Last Post: Nov 15, 2012 11:16 AM

Advanced Search

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

Posts: 71
Registered: 11/9/07
Re: sorting arrays in a cell array
Posted: Nov 14, 2012 3:53 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Steven_Lord" <slord@mathworks.com> wrote in message >
> For such a small problem, if you preallocate firstElementsOfEachCell, using
> the FOR loop to extract the first elements of each cell would probably be
> more efficient (CELLFUN being a much bigger hammer than you need) and easier
> to read.


Exactly right. As it happens, there are other benefits to an explicit FOR loop in this particular case, so that's what I'm doing. The CELLFUN approach is still a good one to keep in mind for future problems, though.

Bruce



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.