フィルターのクリア

How to read import csv file with required header while importing reading csv file?

13 ビュー (過去 30 日間)
I have two csv file WT and both have fixed have 52 header. I tried to use below command to read however header is as Var1,Var2..to Var52 instead of Store no,Date and Time. How can I fix the header problem with importing all the datas from those files? Using opts = detectImportOptions()
table = readtable('WT_201120.csv');
table1 = readtable('WT_.csv');
  2 件のコメント
Stephen23
Stephen23 2021 年 6 月 15 日
Note that your files are formatted differently: the file WT_201120.csv contains each header line quoted within one pair of double quotes, i.e. as one text field. The other two files have many separated fields (some of which are text).
Have you used Excel to manipulate any of those files? Which file uses the correct, original format?
Arshey Dhangekar
Arshey Dhangekar 2021 年 6 月 15 日
hello its in original format. I haven't used excel to manipulate. For WT_201120.csv file how can I solve? I have similar format csv file.

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

採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 6 月 15 日
Here is the solution - data range specified and Variable names set true:
DATA1 = readtable('WT_201120.csv', 'Range','A38:AZ6684', 'ReadVariableNames',true);
% Similarly for the other csv data file.
Note that all column headers are not placed in your csv data except for the first one (Store__No ....). You need to fix this issue in your data file and then import it into MATLAB.
  2 件のコメント
Arshey Dhangekar
Arshey Dhangekar 2021 年 6 月 15 日
hello Without putting range "A38:AZ6684" how can we import using detectImportOptions
opts = detectImportOptions()
Walter Roberson
Walter Roberson 2021 年 6 月 19 日
Do you want us to answer exactly what you just asked, or do you want us to be helpful and show you what you probably actually need?

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by