The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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: 127
Registered: 11/9/07
sorting arrays in a cell array
Posted: Nov 13, 2012 10:22 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Is there a way to sort a cell array of numeric arrays?

I have an N-by-1 cell array, where the cells contains numeric arrays of different lengths (hence the cell array). I'd like to sort them in order of their first elements.

This is an illegal statement that sort of captures what I'm trying to do:

>> sort([myCellArray{:}(1)])

I could do this in a for-loop, of course, but if there's a more Matlab-correct way to do it, I'd like to know.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.