Hello, I am a beginner. I want to find a function or a loop to transform degrees minutes and seconds of latitud and longtitude to radians, since I have some points to work with.
Inputs: Degrees, minutes, seconds, orientation (latitude), Degrees, minutes, seconds, orientation (longitude)
Outputs: Angle in radians of latitude, angle in radians of longitude.
I want the outputs to be saved in different variables, no, let it be overwritten, so I was thinking of calling a function. How would I do this? This is what I've done:
glat=input('\nLatDegrees: ');
mlat=input('\nMin: ');
slat=input('\nSec ');
gradlat=(glat+(mlat/60)+(slat/3600));
rlat=gradlat*(pi/180);%radianslat
v=0;
while(v==0)
senlat=input('\nHemishphere (N/S): ','s');
if(strcmp(senlat,'n')||strcmp(senlat,'N'))
siglat=1;
v=1;
else
if(strcmp(senlat,'s')||strcmp(senlat,'S'))
siglat=-1;
v=1;
else
fprintf('\nWrong');
v=0;
end
end
end
gradlat=siglat*gradlat;
rlat=gradlat*(pi/180);
glong=input('\nLonDeg: ');
mlong=input('\nMin: ');
slong=input('\nSec: ');
gradlong=(glong+(mlong/60)+(slong/3600));
v=0;
while (v==0)
senlong=input('\nHemisphere (E/W): ','s');
if(strcmp(senlong,'e')||strcmp(senlong,'E'))
siglong=1;
v=1;
else
if(strcmp(senlong,'w')||strcmp(senlong,'W'))
siglong=-1;
v=1;
else
fprintf('\nWrong');
v=0;
end
end
end
gradlong=(glong+(mlong/60)+(slong/3600));
rlong=gradlong*(pi/180);%radianslong