971 B
		
	
	
	
	
	
	
	
			
		
		
	
	
			971 B
		
	
	
	
	
	
	
	
Function to
Change the unit of a value.
For matrices, the function is evaluated element wise.
Syntax
math.to(x, unit)
Parameters
| Parameter | Type | Description | 
|---|---|---|
| x | Unit | Array | Matrix | The unit to be converted. | 
| unit | Unit | Array | Matrix | New unit. Can be a string like "cm" or a unit without value. | 
Returns
| Type | Description | 
|---|---|
| Unit | Array | Matrix | value with changed, fixed unit. | 
Throws
| Type | Description | 
|---|
Examples
math.to(math.unit('2 inch'), 'cm')                   // returns Unit 5.08 cm
math.to(math.unit('2 inch'), math.unit(null, 'cm'))  // returns Unit 5.08 cm
math.to(math.unit(16, 'bytes'), 'bits')              // returns Unit 128 bits