number of rows text file

7 ビュー (過去 30 日間)
fima v
fima v 2017 年 2 月 16 日
回答済み: KSSV 2017 年 2 月 16 日
I have opened a txt file using the following code , and i see that there are 1000 lines which i can access,but length or size commands dont show the number of lines extracted(as shown in the attached photo),how can i get the number of lines.
Thanks
fid=fopen('test2.txt');
g = textscan(fid,'%s','delimiter','\n');
fclose(fid)
g{1}{4:71:10000}

採用された回答

KSSV
KSSV 2017 年 2 月 16 日
Try
length(g{1})
Your g will be a cell...you can access your required line n using g{1}(n)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by