<div>Heloíse,</div><div><br></div><div>experimente fazer assim:</div><div><br></div><div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)"><div>lat <- read.table(file="lat.txt")</div>

<div>lon <- read.table(file="lon.txt")</div></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">

library(R.matlab)   # para ler .mat</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">sx <- readMat('SX.mat',maxLength=NULL, fixNames=TRUE,verbose=F,sparseMatrixClass='SparseM')</div>

<div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)"># limites de longitude</div>

<div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">lonSX <- sx$SX[3,1,1]</div><div style="font-family:arial,sans-serif;background-color:rgb(255,255,255)"><font color="#ff0000">lonmin</font><span style="color:rgb(34,34,34)"> <- </span><font color="#ff0000">min(</font><font color="#222222">as.numeric(lonSX$Lon[1:130])</font><font color="#ff0000">)</font></div>

<div style="font-family:arial,sans-serif;background-color:rgb(255,255,255)"><font color="#ff0000">lonmax</font><span style="color:rgb(34,34,34)"> <- <font color="#ff0000">max(</font><font color="#222222">as.numeric(lonSX$Lon[1:130])</font><font color="#ff0000">)</font>
</span></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)"><font color="#ff0000"><br></font></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">

# limites de latitude</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;background-color:rgb(255,255,255)">latSX <- sx$SX[4,1,1]</div><div style="font-family:arial,sans-serif;background-color:rgb(255,255,255)">

<font color="#ff0000">latmin</font><span style="color:rgb(34,34,34)"> <- </span><font color="#ff0000">min(</font><font color="#222222">as.numeric(latSX$Lat[1:130])</font><font color="#ff0000">)</font></div></div><div>
<span style="font-family:arial,sans-serif"><font color="#ff0000">latmax</font></span><span style="font-family:arial,sans-serif;color:rgb(34,34,34)"> <- </span><font color="#ff0000" style="font-family:arial,sans-serif">max(</font><font color="#222222" style="font-family:arial,sans-serif">as.numeric(latSX$Lat[1:130])</font><font color="#ff0000" style="font-family:arial,sans-serif">)</font></div>

<div><font color="#ff0000" style="font-family:arial,sans-serif"><br></font></div><div><font color="#ff0000" face="arial, sans-serif">indice=which(lat<latmax) #indices das latitudes menores do que a máxima</font></div>
<div>
<font color="#ff0000" style="font-family:arial,sans-serif">indice=which(lat[indice]>latmin) </font><span style="color:rgb(255,0,0);font-family:arial,sans-serif">#indices das latitudes maiores do que a minima</span></div>

<div><font color="#ff0000" style="font-family:arial,sans-serif">indice=which(lon[indice]<lonmax) </font><span style="color:rgb(255,0,0);font-family:arial,sans-serif">#indices das longitudes menores do que a máxima</span></div>

<div><font color="#ff0000" style="font-family:arial,sans-serif">indice=which(lon[indice]>lonmin) </font><span style="color:rgb(255,0,0);font-family:arial,sans-serif">#indices das longitudes </span><span style="color:rgb(255,0,0);font-family:arial,sans-serif">maiores do que a minima</span></div>

<div><span style="color:rgb(255,0,0);font-family:arial,sans-serif"><br></span></div><div><span style="color:rgb(255,0,0);font-family:arial,sans-serif">no final vc terá os indices das coordenadas que encerram a área de interesse</span></div>

<div><font color="#ff0000" style="font-family:arial,sans-serif;font-size:9.600000381469727px"><br></font></div><div><font color="#ff0000" style="font-family:arial,sans-serif;font-size:9.600000381469727px"><br></font></div>

<div><font color="#ff0000" style="font-family:arial,sans-serif;font-size:9.600000381469727px"><br></font></div><div><br></div><br clear="all">Atenciosamente,<br>Tito Conte<div><span style="font-size:x-small"><span style="font-size:small"><br>

</span>Instituto Oceanográfico<br>Universidade de São Paulo <br>LabPesq - Laboratório Oceanografia Pesqueira<br></span><br></div><br>