I am unable to import my csv

2 次查看(过去 30 天)
ramakrishna yellapragada
评论: 鑫源 2023-10-15
I am unable to import my csv

回答(2 个)

Dyuman Joshi
Dyuman Joshi 2023-10-15
移动:Image Analyst 2023-10-15
It's working here, see below. So, there seems no problem with the file.
How are you reading the file?
Is the file in the current folder? Use the command "pwd" to check what the current folder is.
y = readtable('air-quality-india.csv')
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
y = 36192×6 table
Timestamp Year Month Day Hour PM2_5 ____________________ ____ _____ ___ ____ ______ 07-Nov-2017 12:00:00 2017 11 7 12 64.51 07-Nov-2017 13:00:00 2017 11 7 13 69.95 07-Nov-2017 14:00:00 2017 11 7 14 92.79 07-Nov-2017 15:00:00 2017 11 7 15 109.66 07-Nov-2017 16:00:00 2017 11 7 16 116.5 07-Nov-2017 17:00:00 2017 11 7 17 124.21 07-Nov-2017 18:00:00 2017 11 7 18 123.45 07-Nov-2017 19:00:00 2017 11 7 19 120.31 07-Nov-2017 20:00:00 2017 11 7 20 108.75 07-Nov-2017 21:00:00 2017 11 7 21 97.8 07-Nov-2017 22:00:00 2017 11 7 22 88.1 07-Nov-2017 23:00:00 2017 11 7 23 81.64 08-Nov-2017 00:00:00 2017 11 8 0 83.82 08-Nov-2017 01:00:00 2017 11 8 1 85.14 08-Nov-2017 02:00:00 2017 11 8 2 90.41 08-Nov-2017 03:00:00 2017 11 8 3 105.33

鑫源
鑫源 2023-10-15
the filename better be an absolute path, rather than a short form.(like C:\**\**.csv
You can use readcsv or readtable
  2 个评论
Image Analyst
Image Analyst 2023-10-15
There is no readcsv, though there is a deprecated csvread which is recommended not to use. I think you meant to use readmatrix or readtable.
Also, specifying the full file name (folder plus base file name plus extension) is a good idea. Use fullfile to do that.
鑫源
鑫源 2023-10-15
thank you for correction. You 're right

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Adding custom doc 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by