How can I import and read a .plt file?

56 views (last 30 days)
Dario Zaccagnino
Dario Zaccagnino on 14 Jul 2022
Answered: dpb on 14 Jul 2022
I am dealing with .plt files and I need to find a way for matlab to read them and put them in a matrix.
  2 Comments
dpb
dpb on 14 Jul 2022
Well, that'll all depend on who wrote the files and what their content/format is...we have no idea where you got these from..
Along with that description, attaching one (use paperclip icon) would be a start.
Dario Zaccagnino
Dario Zaccagnino on 14 Jul 2022
This .plt file is from the NASA CEA solver: https://cearun.grc.nasa.gov/
All I know is that this is a .plt file.
I tried to attach the .plt but the file type of unsupported. Here is the file contents:
# p t pip isp mach gam m
1.8000E+01 3.0124E+03 1.0000E+00 0.0000E+00 0.0000E+00 1.1883E+00 1.9553E+01
1.7791E+01 3.0095E+03 1.0118E+00 1.2275E+02 9.9542E-02 1.1884E+00 1.9554E+01
1.0092E+01 2.7606E+03 1.7836E+00 1.1839E+03 1.0000E+00 1.2012E+00 1.9671E+01
1.0000E+00 1.8073E+03 1.8000E+01 2.4110E+03 2.4771E+00 1.2491E+00 1.9812E+01
# p t pip isp mach gam m
Some potentially helpful information:
Theres 2 ways to perform this CEA solver:
  1. Using the online web version
  2. Using the command prompt version
I am trying to use the command prompt version so I can implement it in a matlab function. This requires me to make a text file to run the solver.
Here is a website that explains how to use the cea solver with cmd: http://akrmys.com/public/cea/cea_install_cmd.html.en and http://akrmys.com/public/cea/cea_index.html.en
Once I am in the >fcea2m "directory", I can run the input file. This input file is a .inp file type (which I can edit in notepad, AND matlab through the editor). This solver outputs in .out and .plt (what I want) file types.
I hope this helps.

Sign in to comment.

Accepted Answer

dpb
dpb on 14 Jul 2022
That's essentially trivial since they're just text files -- to upload one, just rename it ".txt" temporarily; what the name is doesn't matter a lick...
data=readmatrix('yourfile.plt','commentstyle','#');
will give you all the data in an array -- you can separate by what appears to be four rows/section.
Or
data=readlines('yourfile.plt');
will leave you with a string array including the comment lines; you can locate those and then convert the sections between to numeric to keep the sections separate.

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!