Extract data from a text file
显示 更早的评论
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 个评论
Paolo
2018-7-10
Please attach your file
ourimchi omar
2018-7-10
dpb
2018-7-10
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
2018-7-10
KSSV
2018-7-11
Are the number of lines always fixed? Or it will change?
dpb
2018-7-11
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.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import and Export 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!