I want to read text file with numeric data with line breaks every few thousand lines?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Greydon Gilmore
el 24 de En. de 2017
Comentada: Greydon Gilmore
el 24 de En. de 2017
Hello, I have a large text file in the format: '%s %s %s %d %f %f %f %f %f %f %f %f %s'.
Within the rows there are breaks in the data denoted by '---BREAK IN DATA ---'.
I have determined the location of each break by using: row_idx = find(~cellfun('isempty',strfind(data,'--- BREAK IN DATA ---')));
How can I read all the rows of data between each break in the data? With textscan I can read up to the first break in the data and then it is cutoff.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160104/image.jpeg)
Thank you!
0 comentarios
Respuesta aceptada
Walter Roberson
el 24 de En. de 2017
If it is acceptable to read all of the data, then
datacell = textscan(fid, '%s %s %s %d %f %f %f %f %f %f %f %f %s', 'CommentStyle', '--- BREAK IN DATA ---');
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Text Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!