Extract data from large file

3 views (last 30 days)
Paul
Paul on 26 Oct 2011
I've got a very large (50 mB) .mat file with results from a 15 year, 6h run of wave hindcast in various geographical points.
The .mat file is organized in 3 colummns (in which the first two colummns are the geografical location x and y(eg: 37.1234N and 7.67363W), and the 3rd is the parameter I'm interested in) and I want to extract to a file only the data concerning 15 years for only two specific points.
. .
. .
37.4321 8.9823 5
37.4321 8.9850 7
*37.1234 7.6763 8*
. .
. .
37.4321 8.9823 8
37.4321 8.9850 3
*37.1234 7.6763 5*
. .
. .
That means I'll have a smaller file with the same data but only for two points
Any Idea?
Thank you
Paul

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 26 Oct 2011
Use the example below. Be careful about the Data(:,1)==37.1234 comparison though as it involves floating point. You may need to use abs(Data(:,1)-37.1234)<eps instead.
Data=[37.4321 8.9823 5
37.4321 8.9850 7
37.1234 7.6763 8
37.4321 8.9823 8
37.4321 8.9850 3
37.1234 7.6763 5];
Index=and(Data(:,1)==37.1234,Data(:,2)==7.6763);
MyData=Data(Index,3)

More Answers (0)

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!