
Get Scientific Notation for Value

jjweimer
This function will return the base and exponent for scientific notation expressions.
// returns scientific notation vb x 10^ve parameters for input vv Function [variable vb, variable ve] get_scinot(variable vv) ve = floor(log(vv)) vb = vv * 10^(-ve) return [vb, ve] end
You may have need for this to programs slider values that are to be adjustable over multiple decades in range, as shown in the panel below. The slider spans from 1 to 10. The decade multiplier changes the behavior. The example shows when a calculation routine finds a value of 0.6831. The value is passed through the above function, and the returns for vb and ve are used to set the slider to 6.831 and the exponent to -1.
Requires IP9.


Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More