File Exchange

image thumbnail

eng2num

version 1.0.0.0 (1.31 KB) by Jordi Palacin
Decodification of engineering representation.

0 Downloads

Updated 10 May 2005

View License

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

Comments and Ratings (2)

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:
http://www.mathworks.com/matlabcentral/fileexchange/33174

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.

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux