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 Comments

Please attach your file
thanks for reply, here is my file
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
Didn't understand, i've already done something like that for the first function, but i don't think it's correct.
Are the number of lines always fixed? Or it will change?
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.

Sign in to comment.

Answers (0)

Products

Release

R2018a

Asked:

on 10 Jul 2018

Commented:

dpb
on 11 Jul 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!