Prev: FFT-based correlation
Next: hello
From: diego on 16 Mar 2010 13:05 I'm trying tu comunicate two hosts with matlab and when I had used the function 'fscanf' appears this warning: Warning: A timeout occurred before the Terminator was reached and ans = ' ' someone could help me to sove the problem? thanks
From: Walter Roberson on 16 Mar 2010 15:07 diego wrote: > I'm trying tu comunicate two hosts with matlab and when I had used the > function 'fscanf' appears this warning: > Warning: A timeout occurred before the Terminator was > reached > and ans = ' ' > someone could help me to sove the problem? Make sure that the line terminator is the same on both sides, and make sure that the other side is really sending the line terminator, and make sure that the other side is flushing its buffer after constructing the character string to send. On unix-type systems, the line terminator is alway just the newline character (control-J, character value decimal 10). On Windows systems when the object is open in binary mode, the line terminator is the newline character like above. On Windows systems when the object is open in text mode, the line terminator is the character pair of newline followed by carriage return, decimal 10 then decimal 13. With regards to flushing the buffer: either the other end has to be sending without any buffering at all (e.g., have opened the port using the C open() call instead of fopen(), and sends characters using putchar() or putc(), instead of fputs() or fwrite); if the other end is using buffering (fopen() etc) then it has to have fflush() calls at the end of lines, or else it has to use setbuf() or setvbuf(), _unless_ the stream being written to is stdout or stderr, in which case "[T]he standard error stream is not fully buffered; the standard input and standard output streams are fully buffered if and only if the stream can be deterimined not to refer to an interactive device." (Assuming, that is, that the development environment conforms to the C standards...)
|
Pages: 1 Prev: FFT-based correlation Next: hello |