The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: matlab serial/fgets doesn't work with non ascii chars
Replies: 1   Last Post: Feb 4, 2013 4:31 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  

Posts: 4
Registered: 3/26/12
Re: matlab serial/fgets doesn't work with non ascii chars
Posted: Feb 4, 2013 4:31 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"francesc oller" wrote in message <keo1c4$4ph$>...
> executing the script:
> in = serial('/dev/ttyS0', 'BaudRate', 9600, 'DataBits', 8, ...
> 'Parity', 'none', 'StopBits', 1, 'Terminator', 'LF');
> fopen(in);
> line = fgets(in);
> and input data 'ñ\n' (hexa C3 B1 0A), fgets hangs and timeouts, i,e, doesn't recognize LF. This only happens when inputting extended non-ascii strings. I'm using Matlab 7.12 R2011a, can somebody test with R2012?. Thanks

Characters in the extended ASCII set are not supported by MATLAB fscanf (and I would presume fgets as well). I spoke with MATHWORKS support earlier this year when I encountered the same issue. There is a feature request from last year about this but the more people that ask for it, the more likely it will be implemented.

You may have better luck using fread instead of fgets but I have not tried that.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.