Make Matlab to read an US-ASCII file
Mostrar comentarios más antiguos
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 comentarios
Star Strider
el 20 de Sept. de 2012
I suggest you simply write a MATLAB script to do that and see if it works.
If it does, post here how you did it.
If it fails, describe the problem and errors. We may be able to help you solve the problem.
Jan
el 20 de Sept. de 2012
@Star Strider: Your suggestion is efficient for the OP and the forum.
Jan
el 23 de Sept. de 2012
@Alessandro: It motivates the contributors of this forum, if you show as much own effort as possible. Did you even try to write a single line or do you expect us to solve your problem completely?
Walter Roberson
el 23 de Sept. de 2012
Which operating system? And do you have the ability to alter the software that is generating the log file?
Respuestas (1)
Walter Roberson
el 23 de Sept. de 2012
0 votos
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.
1 comentario
Categorías
Más información sobre Data Import and Export en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!