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 Columns Of a Dataset
Replies: 3   Last Post: May 1, 2014 9:23 AM

Advanced Search

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

Posts: 3,919
Registered: 12/7/04
Re: Sorting Columns Of a Dataset
Posted: Apr 29, 2014 4:18 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Wednesday, April 30, 2014 7:53:09 AM UTC+12, Kevin Ellis wrote:
> Hello,
>
>
>
> I have a very large dataset in MatLab and was wondering if it is possible to sort by Name for each column. Each column of data has either a string, date or number depending on the column. The first 5 go as such:
>
>
>
> EQP_Area, EQP_District, EQP_Usage, EQP_Vendor, EQP_Condition_Code
>
>
>
> Is it all possible to move the data columns so that the variable names are in alphabetical order i.e.:
>
>
>
> EQP_Area, EQP_Condition_Code, EQP_District, EQP_Usage, EQP_Vendor
>
>
>
> Now, just to reiterate these are Column Names in a dataset so I would call a column like Data.EQP_Area. I don't want to sort the data in the columns must be move there order. Is there an easy way to do this? Any help would be much appreciated.
>
>
>
> Kevin


[~,isort]=sort(A(1,:)); % Sort the column names in row 1
Asort=A(:,isort); % Re-arrange the columns

Of course, A will be a cell array, right?



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.