Robochameleon  v1.0
Functions
formatPrefixSI.m File Reference

Formats a number for printing using SI prefixes. More...

Go to the source code of this file.

Functions

function formatPrefixSI (in x, in numspec, in unitspec, in base, in nonSI)
 Formats a number for printing using SI prefixes. More...
 

Detailed Description

Formats a number for printing using SI prefixes.

Finds the most appropriate SI prefix to use given an arbitrary input number.

Author
Robert Borkowski
See also
robolog.m
Version
1

Definition in file formatPrefixSI.m.

Function Documentation

function formatPrefixSI ( in  x,
in  numspec,
in  unitspec,
in  base,
in  nonSI 
)

Formats a number for printing using SI prefixes.

Finds the most appropriate SI prefix to use given an arbitrary input number.

Parameters
xInput number to be formatted
numspecNumber format specification [string] [Default: '%1.2f']
unitspecString representing physical quantity. [e.g. 'W'] [Default: empty]
baseBase for numbering system [Default: 10]
nonSIFlag to enable non-traditional unit. Bypasses rounding to nearest power of 3. [optional][Default:false]
Return values
sOutput string
mantissaMantissa
factorPower of 10 to multiply output by to get original value
unitString with SI unit
exponentPower of base corresponding to SI unit
prefixString with SI prefix but not unit