number of rows text file

4 visualizaciones (últimos 30 días)
fima v
fima v el 16 de Feb. de 2017
Respondida: KSSV el 16 de Feb. de 2017
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}

Respuesta aceptada

KSSV
KSSV el 16 de Feb. de 2017
Try
length(g{1})
Your g will be a cell...you can access your required line n using g{1}(n)

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by