How to print the given data in three different text files such that after each iteration the values are appended?

3 ビュー (過去 30 日間)
Hello everyone,
Thank you for your valuable time and help,
I have a variable named Grad that generates different x,y and z co-ordinates after every iteration.
It is given as Grad = [x(1) x(2) x(3)]
I would like the values to be written in a text file with 6 decimal places and seperated by a tab in the text file into three rows representing x(1), x(2) and x(3) for each column. Each time the result is generated it should append such that it values are written for every row.
Can anyone help me with this?
Thank you again

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2023 年 5 月 13 日
編集済み: KALYAN ACHARJYA 2023 年 5 月 13 日
Same way, as I have answered in your another question
diary data_file_name %It will automatically saved in working directory
Just display the data points as you wish (Use Disp function, format of decimal data, use spacer in disp function)
You can also look for the printf function for a more appropriate format.
diary off
More: You may look for other ways also, like table
Create it then write table
HTH
  5 件のコメント
Adeline War
Adeline War 2023 年 5 月 16 日
@KALYAN ACHARJYA Disp function worked for me. Thank you so much.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by