extracting data from .ags file
조회 수: 13 (최근 30일)
이전 댓글 표시
I am looking to get data from .ags files (a kind of text file). The data is in different blocks with enters seperating those blocks and all blocks represent tables with the first line as the name and the rest in table format with commas seperating columns.
Which function and import options could I use to get the seperate tables? I just need a way to start, as I tried using readtable, textscan and the import data button, which doesnt show the file as an option. I also used readlines, that did give me all the lines in seperate cells as strings, but I was not able to create the tables. I added a small part of the data to show how it looks.
댓글 수: 3
jessupj
2023년 12월 7일
편집: jessupj
2023년 12월 7일
long ago, i had written a script to convert *.ags geotech files with specfic content to csv but i'd used the system shell tools (e.g. awk, sed, etc).
If i had to do it all over again, i'd check
and see if i could use the Bentley ags --> csv converter, and then readtable from within matlab.
답변 (1개)
Cris LaPierre
2023년 12월 7일
Not pretty, but here's a quick and dirty template you can use to import AGS files. Since it appears the number of tables in the file can vary, I return the tables in a structure. If you prefer each table be a separate workspace variable, you can uncomment the assignin line of code on line 70.
Again, this is only meant to help get started. It is not extensively tested.
unzip('Show data.zip')
agsS = loadAGS('Show data.ags')
agsS.SCDT
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!