Reputation: 871
I'm trying to download data from excel to matlab. I downloaded data from yahoo finance. I want to load them in matlab however it's not successful. Right down here you have my codes and the message matlab is sending to me. Can somebody help me to improve my codes?
load SP100Duan.csv
Error using load
Number of columns on line 18 of ASCII file C:\Users\11202931\Desktop\SP100Duan.csv
must be the same as previous lines.
Upvotes: 0
Views: 5364
Reputation: 20352
This should be pretty simple . . .
xlsread('C:\Apple.xls', 'Sheet1', 'A1:G10')
Also, please see this link. http://www.mathworks.com/help/matlab/ref/xlsread.html
Upvotes: 0
Reputation: 4529
There are a TON of ways to get data into MATLAB. Generally speaking, mixed text/numbers gives MATLAB problems. You may want to clean up the excel file so there is no text in columns that should be numbers. Some possible methods to load data:
mytable = readtable('mycsvfile.csv')
All your data is put a table datatype, which I personally find convenient.xlsread
function. From your description, it sounds like your datatype is a .csv file though.x = 0
, then (ii) double click on x variable in your workspace, then (iii) copy data from excel and paste into your x variable (iv) execute something like save mydata.mat
so you can later load it with load mydata.mat
Upvotes: 1