Extract data from large file

3 vues (au cours des 30 derniers jours)
Paul
Paul le 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

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 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)

Plus de réponses (0)

Catégories

En savoir plus sur Data Import and Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by