File Exchange

image thumbnail


version (1.51 KB) by Jason Kaeding
Converts a string with (possibly) an SI prefix to a number. Works in reverse of num2sci.

1 Download

Updated 02 Mar 2010

View License

Converts a string with (possibly) an SI prefix to a number. Works in reverse of num2sci. Works with cell arrays of strings also.


num = sci2num('14.5 m') returns num = 0.0145
num = sci2num('14.5') returns num = 14.5
num = sci2num({'14.5m','85.2'}) returns num = [0.0145 85.2]

Cite As

Jason Kaeding (2021). sci2num (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Stephen Cobeldick

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:

Stephen Cobeldick

This submission is a simple and rugged solution to the problem of converting from an SI prefixed string into a numeric. The code concept is very neat, only failing to convert a few of the strings that I tested with, such as combinations of E-notation and prefixes (eg: '1e3 k' -> NaN), and 'Inf' values that also turn into NaNs. It includes some examples and a nice help section, but no H1 line. There are a few "mlint" messages that need attention, but basically it is a good addition to FEX.

Alberto Battistel


Holger Hiebel

I love it and use it very often.

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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!