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

93 views (last 30 days)
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, 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');
Arshey Dhangekar
Arshey Dhangekar on 15 Jun 2021
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.

Sign in to comment.

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 15 Jun 2021
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.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!