MATLAB: Extract data from large file

filelargemat

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

Best Answer

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)