Read mixed text file into array
Mostra commenti meno recenti
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 Commenti
Jan
il 23 Nov 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
il 23 Nov 2017
Jan
il 25 Nov 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
il 26 Nov 2017
Risposte (0)
Categorie
Scopri di più su Data Type Conversion in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
