mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
26 lines
818 B
Markdown
26 lines
818 B
Markdown
# Function unit
|
|
|
|
Create a unit. Depending on the passed arguments, the function will create and return a new math.type.Unit object. When a matrix is provided, all elements will be converted to units.
|
|
|
|
The method accepts the following arguments: unit(unit : string) unit(value : number, unit : string)
|
|
|
|
Example usage: var a = math.unit(5, 'cm'); // 50 mm var b = math.unit('23 kg'); // 23 kg var c = math.in(a, math.unit('m'); // 0.05 m
|
|
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`args` | * | Array | Matrix |
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
Unit | Array | Matrix | value
|
|
|
|
|
|
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|