How to read a .f06 file in MATLAB ?

32 ビュー (過去 30 日間)
Abhimanyu  Kashyap
Abhimanyu Kashyap 2013 年 5 月 2 日
コメント済み: Daniele Pecorella 2021 年 12 月 21 日
Hi there, I am trying to couple NASTRAN and MATLAB to run itiratively. I am using ! bang for running a batch .bat file which inturn runs the specified .bdf file in NASTRAN. Now, my problem is reading the required deflection and forces data from the nastran output .f06 file back into MATLAB. I am able to read the whole file with all that messy huge data. But I am not able to sort out only required numerical data from the huge data of strings n unwanted numbers.
kind help will be much appreciated.
Thanks

採用された回答

José-Luis
José-Luis 2013 年 5 月 2 日
編集済み: José-Luis 2013 年 5 月 3 日
From the .f06 file description:
This is the main Nastran output file. It contains
the results of your analysis such as displacements
and stresses. It is in ASCII format so it can be
viewed in any text editor. It also contains
warning messages, error messages, and diagnostic
messages to help the user evaluate the quality of
the analysis results.
It is a text file that could be opened with textscan(), importdata(), and the like. What function are you using? From your post I am guessing you are reading it as binary data. Another possibility is that the text file and Matlab are using different encodings, so you could check for that.
I have never worked with Nastran, but I imagine that there will be some structure to how the text data is stored. Then you would need to pass the proper arguments to your import function.
If your question is how can I automagically import .f06 data to Matlab then then answer is you can't (as far as I know, but you could always look in the file exchange). I am afraid some effort might be required.
  2 件のコメント
Abhimanyu  Kashyap
Abhimanyu Kashyap 2013 年 5 月 3 日
編集済み: Abhimanyu Kashyap 2013 年 5 月 3 日
Thanks u very much Jose-Luis.. I have been able to import the NASTRAN output f06 file. That file generally has huge information including lots of strings and numbers. As you said, it is taking quite a bit of effort.. Anyway let me try with textscan and importdata again.. The problem I am facing is I dont know how to read only specific numbers which are at known line numbers or locations. Can we read only a few specific lines using aforementioned import or scan commands in matlab ?? that is, for example, if the txt file has say some 200 lines, I want to read only lines 160 to 165 ?? Is it possible ??
Dave
Dave 2014 年 7 月 5 日
could you please describe how you were able to solve your stated problem (reading an .f06 file in MATLAB), so others can learn from it?

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

その他の回答 (2 件)

Kaveh Gharibi
Kaveh Gharibi 2017 年 4 月 25 日
編集済み: Kaveh Gharibi 2017 年 4 月 25 日
I created a Matlab function that is getting the f06 and reads the data line by line in a while loop and then uses textscan() to read the displacement, stress, and other outputs and it does this automatically. Even though the geometry is changing in every iteration, it can read the f06.
  3 件のコメント
Daniele Pecorella
Daniele Pecorella 2021 年 12 月 21 日
Daniele Pecorella
Daniele Pecorella 2021 年 12 月 21 日
Goodmorning, I would be interested too if you could share the code. Thank you

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


M. F.
M. F. 2015 年 10 月 1 日
Use the nastran .pch instead of the .f06, the output data is more structured and easier to read. Otherwise, PYnastran could be of help to directly read in the binary .op2 file.
Regards, Matthias

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by