Home > matutils > angles > radec2str.m

radec2str

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function [ra dec] = radec2str(ra, dec)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  function [ra dec] = radec2str(ra, dec)

  seriously, what do you think it does?  it converts floats ra,
  dec to teh string equivalent.  ra is in hours.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ra dec] = radec2str(ra, dec)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 %  function [ra dec] = radec2str(ra, dec)
0006 %
0007 %  seriously, what do you think it does?  it converts floats ra,
0008 %  dec to teh string equivalent.  ra is in hours.
0009 %
0010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0011 
0012 hr  = floor(ra);
0013 min = floor((ra - hr)*60);
0014 sec = ((ra - hr)*60 - min)*60;
0015 intSec = floor(sec);
0016 remSec = round((sec - intSec)*10000);
0017 ra  = sprintf('%02d:%02d:%02d.%04d', hr, min, intSec, remSec);
0018 
0019 if(dec<0)
0020   decSign = -1;
0021 else
0022   decSign = 1;
0023 end
0024 
0025 dec = abs(dec);
0026 deg = floor(dec);
0027 min = floor((dec - deg)*60);
0028 sec = ((dec - deg)*60 - min)*60;
0029 intSec = floor(sec);
0030 remSec = round((sec - intSec)*10000);
0031 deg = decSign*deg;
0032 dec = sprintf('%02d:%02d:%02d.%04d', deg, min, intSec, remSec);
0033 
0034 return;

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005