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 dates with corresponding strings data
Replies: 2   Last Post: Aug 4, 2013 12:56 AM

Advanced Search

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

Posts: 20
Registered: 3/10/11
sorting dates with corresponding strings data
Posted: Aug 3, 2013 11:32 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

hello, I need to sort dates and need to have string data be sorted along with it's corresponding date. I don't think I can use chars because the text data are not all the same length and don't think I can use cells since I can not include cells in a rowsort(x,[1]) function. Someone must know how to do this and I will be most grateful for any help.

Here is what I have been working with:

xyz={datestr(y);datestr(x);datestr(z)} % matlab will sort this
% c=char('tim','clare','sin')% no, char arrays are sensative to length of the word
% c={'tim';'clare';'sin'} % no, can't row sort a cell
xyzc=[xyz,c] %
rowsort(xyzc,[1]) %i can't get this to work

Thank you,

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.