Read mixed text file into array
Mostrar comentarios más antiguos
I need to read this text file into array, splitting at multiple delimiters, for example at '=','space',etc. I tried 'fscanf', which works for single row, but since the rows have different structure it won't work for the whole file. Can you please help me with this?

4 comentarios
Jan
el 23 de Nov. de 2017
What is fixed and what is variable in the structure? Can e.g. the "(DEG)" change from block to block or could we ignore this detail gratefully? Is the contents of the "# column" line trivial or can it be reordered such that parsing it is obligatory?
Rafik
el 23 de Nov. de 2017
Jan
el 25 de Nov. de 2017
@Rafik: And what is the wanted output? The actual commands are not complicated. fopen, fgetl and fscanf with a specific format are enough. But there are still too many open details to provide reliable code, e.g. if the number of columns in the data is fixed. A guess, what you want as output, might be more confusing than useful, if it differ from your needs. Therefore I hesitate to post code as an answer.
Rafik
el 26 de Nov. de 2017
Respuestas (0)
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
