1
votes

When I import my data (numerical matrix of NYSE stock data), the data isn't loaded properly:

the final part of my CSV data disp() displayed should be -

9.76, 10, 9.99, 9.94, 9.97,9.944,9.95,10,9.956,10.01

What I get when I call the disp(importDataResult) is -

0.0100 0.0099 0.0099 0.0100 etc..

Have you got any idea why when I import the data it is transformed completely? The below link contains my zipped CSV file so you can see the problem (I completely understand if you can't be bothered checking this out, but I'd be interested to know if the same problem applies to others' MATLAB / computers).

https://www.sendspace.com/file/slif0y

The code I'm using is:

function [ c ] = CreateCov_Test()
c = csvread('nyse_data_matrix_no_tags.csv');
disp(c);
end

Here is a screenshot of the issue: https://s32.postimg.org/os74qfrlx/matlab_screen.png

Thank you very much!

1
It's probably better to do a csvread if your data are all numeric and textscan if it contains strings - GameOfThrows
Hi, when I do CSVread the same problem remains - is the numerical matrix too big for MATLAB to handle? I've tried using the 'import data' button, the importdata() function and now the csvread() function. All of them transform the data when I import it - the code is so simple I don't get what can be going wrong. Thanks for trying though! :) - lel23
Make sure there's not a 1.00e+03 or something like that out front of your displayed text result. This is just Matlab making things fit in the format short output. - Matt
Hi Matt, that's strange that it would do that considering the values it is trying to import are things generally between 0 and 100 (not integers). Following is some sample output: --- 0.0137 0.0135 0.0100 0.0137 0.0134 0.0099 0.0137 0.0135 0.0099 0.0137 0.0138 0.0100 0.0137 0.0136 0.0100 0.0138 0.0136 0.0100 --- there is no e or + that I can see, could this still be the problem? I've been trying to work this one out for weeks so any help is appreciated! - lel23
@Mikhail_Sam in this case, this might be better min(importDataResult(:))and max(importDataResult(:)) otherwise you'll get min-value for each column. - Jørgen

1 Answers

0
votes

Matlab is not transforming any data. The configuration of who Matlab is displaying variables is controlled with format, the default being format short.

An excerpt from the documentation:

format may be used to switch between different output display formats of all float variables as follows:

format SHORT Scaled fixed point format with 5 digits.

So what does Scaled fixed point format with 5 digits mean, well lets see

>> a = [0.1 10000 100]
>> disp(a)
   1.0e+04 *

    0.0000    1.0000    0.1000

Note the 1.0e+04 *, its a multiplier for all data in the matrix. When displaying a large matrix, this multiplier is often hidden (as in your case), which admittedly can be rather confusing.