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 Data based on same numbers
Replies: 1   Last Post: Sep 27, 2012 7:40 PM

Advanced Search

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

Posts: 3
Registered: 9/27/12
Sorting Data based on same numbers
Posted: Sep 27, 2012 10:28 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello,
I'm trying to import and sort data (programatically) in Matlab
Here is my issue (i'm gonna paste a little part of the file that I have)

"# Sourcefile: rainCRU
# prec
# unit: null

-37.0000 -6.7500 1901-01-02 15.000000000000
-36.5000 -6.7500 1901-01-02 12.000000000000
-36.0000 -6.7500 1901-01-02 11.000000000000
-37.0000 -6.2500 1901-01-02 18.000000000000
-36.5000 -6.2500 1901-01-02 16.000000000000
-36.0000 -6.2500 1901-01-02 13.000000000000
-37.0000 -6.7500 1901-02-02 130.000000000000
-36.5000 -6.7500 1901-02-02 91.000000000000
-36.0000 -6.7500 1901-02-02 63.000000000000
-37.0000 -6.2500 1901-02-02 123.000000000000
-36.5000 -6.2500 1901-02-02 92.000000000000
-36.0000 -6.2500 1901-02-02 67.000000000000
-37.0000 -6.7500 1901-03-02 179.000000000000"

as you can see.. the first and second column are latitude and longitude, third is date and fourth is precipitation (mm)

and as you can see.. the same latitude and logitude is being repeated over and over again...

What I woud like to do?

Build a code extract these data from .txt or .xls (that I have) and Matlab could sort by location (same latitude and longitude) and my file should be like this

...
-37.0000 -6.7500 1901-01-02 15.000000000000
-37.0000 -6.2500 1901-01-02 18.000000000000
-37.0000 -6.7500 1901-02-02 130.000000000000
-37.0000 -6.2500 1901-02-02 123.000000000000
-36.5000 -6.7500 1901-01-02 12.000000000000
-36.5000 -6.2500 1901-01-02 16.000000000000
...

(this file here is just a sample, not the official one)

Did you understand? I have almost 400 points and precipitation information about these points in almost 30 years (348 months, for 400 places, it should give me more 139200 rows of information in Matlab which is so much information and I must sort this rows by same location)

I really appreciate your help!
Thank you in advance.
Thiago.








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.