- install the document monitor plugin, which checks every three seconds if a file has changed, and updates it if it has.
- it warns when a file has been closed, and gives the option to reload.
- 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.
Can I see the contents of a csv file live while matlab is still working on it
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposte (3)
Stephen23
il 14 Mag 2017
1 Commento
Walter Roberson
il 14 Mag 2017
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
il 14 Mag 2017
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.
0 Commenti
Ajit Dubey
il 6 Apr 2021
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!!
0 Commenti
Vedere anche
Categorie
Scopri di più su Environment and Settings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!