$LastChangedDate: 27-Juil-2011 $

# CL_unitConvert

Unit conversion

## Calling Sequence

       [val2] = CL_unitConvert(val1, unit1, unit2)

## Description

- Converts a quantity expressed in unit1 into unit2. The recognized units are:

  m: meter

  km: kilometer (1000 meters)

  s: second

  mn: minute (60 seconds)

  h: hour (60 minutes)

  day: day (24 hours)

  yr: year (365.25 days)

  g: gramme

  kg: kilogramme (1000 grammes)

  au: astronomical unit (%CL_au)

  N: newton

  Hz: herz

  kHz: kiloherz (1000 Hz)

  rad: radian

  deg: degree (%pi/180 radians)

- Notes:

  - The consistency between unit1 and unit2 is not checked. Thus CL_unitConvert(1, "kg", "m") generates no error!.

  - The case where some existing variable is passed in place of a valid unit is not detected either.

## Parameters

val1:

  Value of some quantity 'X' expressed in unit1.

unit1:

  Initial unit (string).

unit2:

  Final unit (string).

val2:

  Value of 'X' expressed in unit2. val2 is [] if the units are not valid.

## Authors

- CNES - DCT/SB (AL)

## Examples

    val = CL_unitConvert(1, "m/s", "km/h")
    val = CL_unitConvert(1, "au^2", "km^2")
    val = CL_unitConvert(0:90:360, "deg", "rad")