How to extract data from diary?
古いコメントを表示
Hello,
I've used the diary function to create a diary file. When I open the diary file, I've got the following:
normal
1.0e+03 *
1.1797 0.2894 0.0010
1.1797 0.2894 -0.0010
open
1.0e+03 *
1.1797 0.2894 0.0010
1.1797 0.2894 -0.0010
normal
1.0e+03 *
1.2787 0.5115 0.0010
1.2787 0.5115 -0.0010
Now, I want to capture all the numbers that follow after the word 'normal', so I only want the numbers depicted in bold here. How do I read the diary file in Matlab and extract the numbers I want from the diary file?
Thank you.
2 件のコメント
Rik
2020 年 6 月 19 日
The diary file is a plain text file, so you can read it like any other. Then you will have to select the lines that describe the values of normal, and make sure you correctly parse the factor.
If you want more specific help, you can attach the file to your question.
採用された回答
その他の回答 (1 件)
Jyotirmay Mishra
2020 年 6 月 19 日
0 投票
Hi,
You can import the diary file as dataset from the import data option in the home tab of MATLAB. Make sure that you select the datatype for the first coloumn as Text or else the text ''normal", "open" will be replaced by NaN.
Now you can use some logic using the a loop and some conditional statements to obtain the data after normal
カテゴリ
ヘルプ センター および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!