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

10 views (last 30 days)
I am trying to iterate through the number of rows in a certain column in an excel document. How do i assign a variable called numRows that stores the number of rows with data in a csv file?

Accepted Answer

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

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!