Convert an array into floating numbers
Show older comments
Hello,
I have an dataset(49 by 9). I want to convert an array(49 by 1) in the dataset from exponential notation (e.g 1.003 e +03) into floating numbers.
Answers (1)
Use STR2DOUBLE or STR2NUM.
10 Comments
Reyasudin
on 11 Jun 2013
Show me how to create a small array of the kind you're thinking of. I can't tell what you mean by "an array of exponential values" and its distinction from a floating point number. When I do this,
>> a=1.003e+03
a =
1003
I am creating a variable 'a' using exponential notation, but WHOS shows you immediately that it is a double floating point value.
>> whos a
Name Size Bytes Class Attributes
a 1x1 8 double
Reyasudin
on 11 Jun 2013
Matt J
on 11 Jun 2013
Execute this at the command line and then re-display
>> format short
Reyasudin
on 11 Jun 2013
Matt J
on 11 Jun 2013
It doesn't matter how the data was created. Your question has nothing to do with the contents of the variable. Your question is about how to control the way it is displayed at the command line. See the FORMAT command for the different options.
>> doc format
Reyasudin
on 11 Jun 2013
When I open the dataset
You mean when you open it in the Variable Editor? Under the "View" menu, and within that under the "Numeric Array Format" menu there are options to change the way numbers are displayed (short, long, etc...). It is very similar to the FORMAT command.
Reyasudin
on 11 Jun 2013
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!