How to read .csv files in MATLAB 2019a?

1 回表示 (過去 30 日間)
Ivan Mich
Ivan Mich 2019 年 12 月 23 日
回答済み: Walter Roberson 2019 年 12 月 23 日
Sorry,
I have a problem with a command. In Matlab version 2015a I used to use commands
filename1= 'B_STAT.xlsx'
[d1,tex]= xlsread(filename1);
REAL_B=d1(:,3);
REAL_B=d1(:,4);
in order to open a file and separate columns. In 2019a version I am not allowded to use these commands: In command window shows me that : "Error in line 2"
Could someone help me in order to fix my problem?

採用された回答

Walter Roberson
Walter Roberson 2019 年 12 月 23 日
Those are still valid commands in MATLAB.
However if you do not happen to be using MS Windows with Excel installed, then you would get a warning that "Basic" mode would be used, and it would try to find B_STAT.csv which probably does not exist.
You can use
d1 = readtable(filename1);
to do the reading. You might need
d1 = readtable(filename1, 'readvariablenames', false);
The result either way would be a table() object, and then
REAL_B = d1{:,3};

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFiles and Folders についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by