linecount.m

来自「人脸识别matlab程序 with a principal component」· M 代码 · 共 22 行

M
22
字号
function lc = linecount(filename)%LINECOUNT Count the number of lines in given file%%          LC = LINECOUNT(FILENAME) Returns LC, the number of%          lines in text file named FILENAME, or 0 if the file%          does not exist or is not readable.% Matthew Dailey 2000  fid = fopen(filename,'r');  if fid < 0    lc = 0;  else    lc = 0;    while 1      ln = fgetl(fid);      if ~isstr(ln) break; end;      lc = lc + 1;    end;    fclose(fid);  end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?