Syntax

``[A1,...,An] = fromRadians(toUnits,R1,...,Rn)``

Description

example

````[A1,...,An] = fromRadians(toUnits,R1,...,Rn)` converts the angles specified by `R1,...,Rn` from radians to the units specified by `toUnits`. This function is useful for converting angles from radians when you do not know the output units until run-time. ```

Examples

collapse all

Convert several values from radians to degrees.

`[A1,A2,A3,A4] = fromRadians("degrees",pi/2,pi,3*pi/2,2*pi)`
```A1 = 90 ```
```A2 = 180 ```
```A3 = 270 ```
```A4 = 360 ```

Convert the same values from radians by specifying an array.

```R = [pi/2 pi 3*pi/2 2*pi]; A = fromRadians("degrees",R)```
```A = 1×4 90 180 270 360 ```

Input Arguments

collapse all

Output unit, specified as `"degrees"` or `"radians"`. You can also specify abbreviations such as `"deg"` and `"rad"`.

Data Types: `char` | `string`

Angles in radians, specified as one or more numeric arrays.

Output Arguments

collapse all

Angles in degrees or radians, returned as the same number of numeric arrays as in `R1,...,Rn`. The size of each output array matches the size of the corresponding input array.

Version History

Introduced in R2007b