Read from text file (vw9.out)

1 回表示 (過去 30 日間)
RAJAN PRASAD
RAJAN PRASAD 2020 年 9 月 10 日
コメント済み: Mario Malic 2020 年 9 月 10 日
I have two matrix generated in ANSYS and written in vw9.out as a text file
A = [
35.217 35.087 34.713 34.138
35.217 35.087 34.713 34.138
47.942 48.091 48.522 49.193
47.942 48.091 48.522 49.193
]
B = [
20.266 19.457 18.691
20.266 19.457 18.691
69.078 70.592 72.097
69.078 70.592 72.097
]
C =[A B ]
I want to import these matrix in matlab.
using fopen('vw9.out','r');
I am not able to do it. Can anybody suggest how to do it.

採用された回答

Johannes Hougaard
Johannes Hougaard 2020 年 9 月 10 日
You can read it using
fid = fopen('vw9.out','r');
fcon = textscan(fid,'%s');
but if all you want to do is to import the matrices the easiest would be to rename the file to vw9.m and execute it as a script.
run('vw9.m')
  2 件のコメント
RAJAN PRASAD
RAJAN PRASAD 2020 年 9 月 10 日
Thank you run(vw9.m) works great
Mario Malic
Mario Malic 2020 年 9 月 10 日
This solution is super smart!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by