Reputation: 53
I am trying to read in CSV files to Matlab. For some reason Matlab is converting some of the numbers to -INF.
I have tried using readmatrix
and textscan
functions. Textscan
forces me to use str2double
to convert it to a double and it produces the same -INF values as importing the data in with the readmatrix
function. Is there a better function to read in a CSV file into MATLAB?
Example: -1.79769313486235E308 is being converted to -INF.
The CSV files are formatted as follows: (with no spaces between the rows)
Header 1, Header 2, Header 3
190, -1.47457265853882, 0.0837953791871611
191, -1.1680064201355, 0.126324314114211
192, -1.64672422409058, 0.254686301760985
193, -1.84958028793335, 0.172680441425988
Upvotes: 0
Views: 70
Reputation: 30047
Within machine precision, -1.79769313486235E308
is -Inf
!
From the docs:
MATLAB constructs the double data type according to IEEE® Standard 754 for double precision. The range for a negative number of type double is between -1.79769 x 10^308 and -2.22507 x 10^-308.
So your value here is the most negative value possible for a double in MATLAB. It's likely that Excel uses the same IEEE standard, and is therefore also bottoming out at -Inf just without formatting it accordingly.
Upvotes: 2