How to search for matching values

Hi. I have a table of latitude, longitude and shear wave anomaly (this is a text file). I would like to search this table for minimum shear wave anomaly within a given range of latitude and longitude (say 30 - 50 latitude, and 0 - 20 longitude). what would be the best way of doing this? i have tried using the intersect function but have problems and it doesn't return repeated values.
cheers alex

댓글 수: 1

Why not use min presuming this is an actual minimum?
To select subsets of the data it's convenient to use a helper function to make writing the conditions more concisely hiding the details --
ix=(iswithin(lat,30,50) & iswithin(long,0,20)); % indices that satisfy
[amin,idx]=min(dat(ix));
Above assumes a vector of lat and long; arrange the indices appropriately for your data structure. My utility function is...
function flg=iswithin(x,lo,hi)
% returns T for values within range of input
% SYNTAX:
% [log] = iswithin(x,lo,hi)
% returns T for x between lo and hi values, inclusive
flg= (x>=lo) & (x<=hi);
Simple and possible to write inline but it tends to make code much more legible to hide the logic operators...

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Tables에 대해 자세히 알아보기

질문:

2013년 10월 22일

댓글:

dpb
2013년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by