select data from specific range
Mostra commenti meno recenti
Dear all,
My file have 3 column and more than hundred line..First column represent latitude, second longitude and lastly sea level. My plan is to average the sea level data based on specific range of latitude and longitude..I try design the program but still not work..Let say my file name is 200012.txt and i try to extract sea level data in range of (2<lat<3) & (95<lon<97)..But still not success. Help me
f=load('200012.txt'); lat=f(:,1); lon=f(:,2); sla=f(:,3);
x=sla(find((2<lat<3) & (95<lon<97)))
1 Commento
Chandra Kurniawan
il 25 Dic 2011
Would you upload your txt file?
Risposta accettata
Più risposte (4)
Chandra Kurniawan
il 25 Dic 2011
If size of i and j are same, then
f = load('200012.txt');
lat = f(:,1);
lon = f(:,2);
sla = f(:,3);
i = 2 : 0.25 : 15;
j = 95 : 0.25 : 126;
for x = 1 : numel(i)-1
r = sla(find(lat >=i(x) & lat <= i(x+1) & lon >= j(x) & lon <= j(x+1)))
b = mean(r)
end
This code I just use x = 1 : 53
1 Commento
joo tan
il 25 Dic 2011
joo tan
il 25 Dic 2011
1 voto
Image Analyst
il 25 Dic 2011
Try something like this (I didn't test it):
rowsToAverage = lat>2 & lat<3 & lon>95 & lon<97;
meanValue = mean(sla(rowsToAverage));
1 Commento
joo tan
il 25 Dic 2011
joo tan
il 25 Dic 2011
0 voti
Categorie
Scopri di più su Geographic Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!