Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_vupack

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries

Abstract


   CSPICE_VUPACK unpacks three scalar components from a vector.

I/O


   Given:

      v        a double precision 3-dimensional vector.

               [3,1] = size(v); double = class(v)

   the call:

      [x, y, z] = cspice_vupack( v )

   returns:

      x,
      y,
      z        the double precision scalar components of the vector `v'.

               [1,1] = size(x); double = class(x)
               [1,1] = size(y); double = class(y)
               [1,1] = size(z); double = class(z)

               The following equalities hold:

                  x = v(1)
                  y = v(2)
                  z = v(3)

Parameters


   None.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Suppose that you have an instrument kernel that provides,
      within a single keyword, the three frequencies used by the
      instrument, and that you want to use these frequencies
      independently within your code.

      The following code example demonstrates how to use cspice_vupack
      to get these frequencies into independent scalar variables.

      Use the kernel shown below, an IK defining the three
      frequencies used by an instrument with NAIF ID -999001.


         KPL/IK

         File name: vupack_ex1.ti

         The keyword below define the three frequencies used by a
         hypothetical instrument (NAIF ID -999001). They correspond
         to three filters: red, green and blue. Frequencies are
         given in micrometers.

         \begindata

            INS-999001_FREQ_RGB   = (  0.65,  0.55, 0.475 )
            INS-999001_FREQ_UNITS = ( 'MICROMETERS'       )

         \begintext


         End of IK


      Example code begins here.


      function vupack_ex1()

         %
         % Local parameters.
         %
         IKNAME = 'vupack_ex1.ti';
         KEYWRD = 'INS-999001_FREQ_RGB';

         %
         % Load the instrument kernel.
         %
         cspice_furnsh( IKNAME );

         %
         % Get the frequency data from the kernel pool.
         %
         [ddata, found] = cspice_gdpool( KEYWRD, 1, 3 );

         if ( found )

            [red, green, blue] = cspice_vupack( ddata );
            fprintf( 'Blue  (nm):  %5.2f\n', blue  * 1000.0 )
            fprintf( 'Green (nm):  %5.2f\n', green * 1000.0 )
            fprintf( 'Red   (nm):  %5.2f\n', red   * 1000.0 )

         else

            fprintf( 'No data found in the kernel pool for %s\n', KEYWRD )

         end

         %
         % It's always good form to unload kernels after use,
         % particularly in Matlab due to data persistence.
         %
         cspice_kclear


      When this program was executed on a Mac/Intel/Octave5.x/64-bit
      platform, the output was:


      Blue  (nm):  475.00
      Green (nm):  550.00
      Red   (nm):  650.00


Particulars


   Basically, this is just shorthand notation for the common
   sequence

      x = v(1)
      y = v(2)
      z = v(3)

   The routine is useful largely for two reasons. First, it
   reduces the chance that the programmer will make a "cut and
   paste" mistake, like

      x = v(1)
      y = v(1)
      z = v(1)

   Second, it makes conversions between equivalent units simpler,
   and clearer. For instance, the sequence

      x = v(1) * cspice_rpd()
      y = v(2) * cspice_rpd()
      z = v(3) * cspice_rpd()

   can be replaced by the (nearly) equivalent sequence

      v         = cspice_rpd() * v;
      [x, y, z] = cspice_vupack( v );

Exceptions


   1)  If the input argument `v' is undefined, an error is signaled
       by the Matlab error handling system.

   2)  If the input argument `v' is not of the expected type, or it
       does not have the expected dimensions and size, an error is
       signaled by the Mice interface.

Files


   None.

Restrictions


   None.

Required_Reading


   MICE.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)

Version


   -Mice Version 1.0.0, 07-SEP-2020 (JDR)

Index_Entries


   unpack three scalar components from a vector


Fri Dec 31 18:44:28 2021