This function decodes an engineering representation:
[valor,unidad] = eng2num(string_valor)
[0.01,'F'] = eng2num('10mF')
[0.01,''] = eng2num('10m')
0.01 = eng2num('10m')
Also available num2eng
Jordi Palacin (2021). eng2num (https://www.mathworks.com/matlabcentral/fileexchange/7615-eng2num), MATLAB Central File Exchange. Retrieved .
Disclaimer: In the end I could not find any FEX submission that gave the correct outputs for the wide range of test-cases that I tried, so I ended up writing my own function. You can find it here:
As per its corollary "num2eng" from the same author, this file is also missing an H1 line, has several mlint messages that need attention, uses a "for" loop with a "break" command, and repeats a lot of code. The conversion behavior is substandard, particularly the complete inability to recognize the SI prefixes y, z, a, n, E, Z, and Y. In addition any negative, Inf or NaN value returns an empty numeric without warning, eg: '-1' -> . E-notation in the number is ignored, and for the prefixes p and f incorrect values are returned, eg: '1 p' -> 1e-9 (should be 1e-12).
This submission needs a major re-write.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!