Make Matlab to read an US-ASCII file
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I software that I use creates an US-ASCII log-text-file (but without extension) while it works.
Is there a way to read by Matlab that file in realtime (while the external software updates it) and then to load log-file and updates?
Thanks.
6 件のコメント
Walter Roberson
2012 年 9 月 23 日
Which operating system? And do you have the ability to alter the software that is generating the log file?
回答 (1 件)
Walter Roberson
2012 年 9 月 23 日
The US-ASCII vs ISO 8859-1 and so on, is not going to be an appreciable problem for you.
Your problem is your operating system. The output file is going to be locked by MS Windows during the time the process has it open for writing, and unless you can take special precautions you are not going to be able to open it for reading until after it is closed.
I have not been able to find out what has to be done to allow reading of files as they are being written. MS Windows' normal IO functions do not document the fact that the locking will be done, making it difficult for me to track down how the locking is happening or how to turn it off.
The sort of locking that MS Windows is doing is known as "mandatory file locking", and it is not supposed to happen in POSIX compatible operating systems (which MS Windows XP SP2 and later claim to be) until you get to Trusted security level B1 or higher, which MS Windows definitely is not. (I'm not sure what level it is; I have seen claims that it is D4 but it might possibly have climbed to C2.) As it is not supposed to happen, the mechanisms to deal with it are not standardized.
Because of this locking difficulty, it is not useful for me to describe the mechanisms that would normally be used on POSIX-compatible operating systems that do not have this locking behavior.
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!