フィルターのクリア

importing csv file into matlab

2 ビュー (過去 30 日間)
sri satya ravi
sri satya ravi 2017 年 1 月 10 日
編集済み: per isakson 2017 年 1 月 11 日
Hi,
I am having error while using csv read for the following file.
num = csvread (FileName,2,0);
Error using dlmread (line 143)
Mismatch between file and format string.
Trouble reading 'Numeric' field from file (row number 1, field number 57) ==>
N,N,N,N,N,N,N,Y,N,N\n
Is there a way to read the following sheet into matlab.
Thanks...!!!!

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 11 日
csvread() is unable to read files with text, with the possible exception of header rows and maybe leading columns of text -- definitely not text at the end of lines.
If you have R2013b or later, I suggest you use
datatab = readtable('matlab_upload.csv', 'headerlines', 1);
  2 件のコメント
sri satya ravi
sri satya ravi 2017 年 1 月 11 日
編集済み: per isakson 2017 年 1 月 11 日
Hi Walter; That worked for me if i am giving the file name directly into the command readtable.
I am not getting it when i ask it select the file. Didn't understand what the difference is.
[FileName,PathName] = uigetfile('C:\Users\Yashwanth\Desktop\workbased_window\*.CSV;*.mdl;*.mat','Select the CSV code file');
datatab = readtable('FileName', 'headerlines', 1);
I get error "Unable to open file 'FileName'."
per isakson
per isakson 2017 年 1 月 11 日
編集済み: per isakson 2017 年 1 月 11 日
Replace
datatab = readtable('FileName', 'headerlines', 1);
by
datatab = readtable( FileName, 'headerlines', 1);
FileName is the name of a string variable. The value of the variable, FileName, is the name of the file.

サインインしてコメントする。

その他の回答 (1 件)

halleyhit
halleyhit 2017 年 1 月 10 日
I think it is because the csv file contains too many strings. csvread is to load data not string. You can use "Improt data" on your "Home" label. Also you can generate script or function in this tool.

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by