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
Paolo 2018 年 7 月 10 日
Please attach your file
ourimchi omar
ourimchi omar 2018 年 7 月 10 日
thanks for reply, here is my file
dpb
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
ourimchi omar 2018 年 7 月 10 日
Didn't understand, i've already done something like that for the first function, but i don't think it's correct.
KSSV
KSSV 2018 年 7 月 11 日
Are the number of lines always fixed? Or it will change?
dpb
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 件)

製品

リリース

R2018a

質問済み:

2018 年 7 月 10 日

コメント済み:

dpb
2018 年 7 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by