フィルターのクリア

Add a row to a textfile with columns

1 回表示 (過去 30 日間)
lou
lou 2018 年 2 月 15 日
コメント済み: lou 2018 年 2 月 15 日
I have a .txt file that has two columns. It looks like this
Age 3
Salary 52661
Average working hours 40
Conditions 1, 26, 65, 89, 20, 2, 2
I would like to add a row
Favorite numbers 2, 8, 66
I would like to ask what would be the best way for doing this? I would like to keep the column-alignment.

採用された回答

Birdman
Birdman 2018 年 2 月 15 日
Consider your data is saved in data.txt file:
fid=fopen('data.txt','a+');
fprintf(fid,'\n%s %d, %d, %d\n',"Favorite numbers",2,8,66);
fclose(fid)
  1 件のコメント
lou
lou 2018 年 2 月 15 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by