Extract data from a text file
Mostrar comentarios más antiguos
Hi, I have a text file that contains specific parameters, I want to create standard functions, to extract these parameters and write them according to the standard used in the image below, I want to create 3 functions 1- load_materials 2- load_points 3-load_polygones all future text files should have the same format, see the attached image thanks for help

6 comentarios
Paolo
el 10 de Jul. de 2018
Please attach your file
ourimchi omar
el 10 de Jul. de 2018
dpb
el 10 de Jul. de 2018
Read the whole file and do the selection in memory...if you read into table and create an auxiliary variable based on the existence of the matching string for the three classes as a categorical variable, then the grouping and conversion becomes trivial via
findgroups
splitapply
and/or
varfun
ourimchi omar
el 10 de Jul. de 2018
KSSV
el 11 de Jul. de 2018
Are the number of lines always fixed? Or it will change?
dpb
el 11 de Jul. de 2018
I misunderstood the initial Q? thinking you had the two columns and just needed to split; not to build the RH column. For the latter, store the base text lines in a lookup table and then have to read the input file knowing it's composition. You can again read that full file into memory (cell array) and walk through it rather than reading record-by-record or you can read the counted number of records after reading the various counts; your choice.
Respuestas (0)
Categorías
Más información sobre Data Import and Export en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!