How can I import and read a .plt file?

151 ビュー (過去 30 日間)
Dario Zaccagnino
Dario Zaccagnino 2022 年 7 月 14 日
回答済み: dpb 2022 年 7 月 14 日
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 件のコメント
dpb
dpb 2022 年 7 月 14 日
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 2022 年 7 月 14 日
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.

サインインしてコメントする。

採用された回答

dpb
dpb 2022 年 7 月 14 日
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.

その他の回答 (0 件)

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by