フィルターのクリア

Can I see the contents of a csv file live while matlab is still working on it

13 ビュー (過去 30 日間)
Dubstep Dublin
Dubstep Dublin 2017 年 5 月 14 日
回答済み: Ajit Dubey 2021 年 4 月 6 日
Hello,
My code is writing some data actively into a csv file. I would like to open the csv file and see what my matlab code writes into it live while the csv file is still open in excel and matlab is continuously writing data into it.
Is it possible, if yes how can I do it.
Thanks.

回答 (3 件)

Stephen23
Stephen23 2017 年 5 月 14 日
This is easy with Notepad++:
  1. install the document monitor plugin, which checks every three seconds if a file has changed, and updates it if it has.
  2. it warns when a file has been closed, and gives the option to reload.
  3. it also has a manual option in the File menu Reload from Disk. You could add a shortcut Settings... -> Shortcut Mapper..., and make a keyboard shortcut for updating using some keys.
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 5 月 14 日
Note: how well this will work depends on exactly how the output is being written to the file. csvwrite() and dlmwrite() and xlswrite() might only update the file every 8 kilobytes or so.
If you are using fwrite() or fprintf() then some documentation hints that the output file will be flushed after every fwrite() or fprintf(), but this is not made explicit.

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


Jan
Jan 2017 年 5 月 14 日
The operating system is resonpsible for writing data to the disc. The bytes delivered by fwrite can be cached by Matlab, the OS and the hard disk also. See e.g. https://support.microsoft.com/en-us/help/324805/how-to-manually-turn-disk-write-caching-on-or-off and https://msdn.microsoft.com/en-us/library/windows/desktop/aa364218(v=vs.85).aspx. It matters if the file was opened by fopen in 'w' or 'W' mode.
On my system, the files are written in chunks of 1024 bytes, but I would not rely on this.
Conclusion: There is no reliable way to see the file's contents in real time. If you really need this feature, create a different strategy: Expand the function for writing the CSV file by a part, which copies the output to the display of an editor directly.

Ajit Dubey
Ajit Dubey 2021 年 4 月 6 日
An easy fix for this is copy paste the file that is being written and you can open the copy file and see the current status...
It might be very late for this answer but it might be useful for anyone searching in future!!

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by