from
linecount
by Guru
Counts the number of lines in a text file
|
| linecount(fid)
|
function n = linecount(fid)
% LINECOUNT returns how many lines exist inside of a text file that you are
% trying to read.
%
% SYNTAX: n = linecount(fid)
% Input:
% fid - file identifier acquired from fopen
% Output:
% n - number of lines in the file
%
% Author: Guru
% For support, E-Mail: thematlabguru@gmail.com
n = 1;
tline = fgetl(fid);
while ischar(tline)
tline = fgetl(fid);
n = n+1;
end
|
|
Contact us