How do I count the number of columns in a csv file?

14 Ansichten (letzte 30 Tage)
Jasmine Shah
Jasmine Shah am 23 Nov. 2019
Beantwortet: Walter Roberson am 24 Nov. 2019
I am trying to iterate through the number of columns as well as rows in an excel document. How do i assign a variable called numCols that stores the number of Columns with data in a csv file?

Antworten (1)

Walter Roberson
Walter Roberson am 24 Nov. 2019
datatable = readtable('YourFile.csv', 'ReadVariableNames', false); %or true if there is a header
numRows = height(datatable);
numCols = width(datatable);

Kategorien

Mehr zu MATLAB Report Generator finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by