Re-organize LS-DYNA data from text file removing header and footer
Ältere Kommentare anzeigen
Hello,
I'm trying to extract data from an LS-DYNA output text file and write it into a new file with a new format, but I find the initial format a bit complicated and I have problem getting what I want, which is:
- Header: keep the same (LS-DYNA keyword ... date)
- One line with the legend of the data, with timestep and time moved to columns 1 and 2, respectively (two new columns should be created)
- N lines with the actual data
- No footer
The starting file looks like this:

and I'd like to have it like this

From that point I can use textscan to manipulate the data the way I want.
Numpy library in Python has the command genfromtxt that allows to remove header and footer, then choose which data to extract from a specific column of a specific line. I couln't find such a command in MATLAB, and i tried with a combination of, fgets, fgetl, and textscan, but impossible to achieve what I'm looking for.
Does anyone have an idea of which function would work best?
Thanks a lot!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Text Files finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!