Code covered by the BSD License  

Highlights from
num2str with metric prefix

5.0

5.0 | 4 ratings Rate this file 4 Downloads (last 30 days) File Size: 1.37 KB File ID: #20950

num2str with metric prefix

by Mark T

 

01 Aug 2008 (Updated 12 Aug 2008)

Converts numbers to strings in engineering notation

| Watch this File

File Information
Description

Converts numbers to strings in engineering notation. Produces string (array) from numbers with mantissa and metric prefix (every third power of 10 between 1e-24 to 1e24).

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
18 Nov 2010 Lars Olav Vestland

Very nice

18 Nov 2010 Lars Olav Vestland

hm doesnt seems handle the certain tick that is zero

10 Aug 2011 Adriano  
13 Dec 2011 Anthony  
07 Feb 2012 David

Very useful. However, there is an error when the input vector contains both a value that needs a prefix, and one that does not. (i.e. [10 0.001]).

Modification to output cell arrays instead of string arrays will fix the error.

Alternatively, changing strvcat to char will also fix the error, but you'll be left with an extra space on those values without a prefix.

Please login to add a comment or rating.
Updates
12 Aug 2008

Incorrect use of cat, instead of strvcat was causing error for some input vectors...oops!

Tag Activity for this File
Tag Applied By Date/Time
num2str Mark T 22 Oct 2008 10:12:58
metric Mark T 22 Oct 2008 10:12:58
prefix Mark T 22 Oct 2008 10:12:58
utilities Mark T 22 Oct 2008 10:12:58
notation Mark T 22 Oct 2008 10:12:58
engineering Mark T 22 Oct 2008 10:12:58
si Lars Olav Vestland 18 Nov 2010 04:05:30

Contact us at files@mathworks.com