From: Ugur Bozkurt on 26 Jul 2010 01:34 > FSCANF and FPRINTF are specialized functions for 7 bit ASCII communication. > What you describe sounds like 8 bit binary communication which is handled by > FREAD and FWRITE. Try the following: > > >> echoudp('on',30000); > >> u=udp('localhost',30000); > >> fopen(u); > >> fwrite(u,char([161,160,65,0,0,0,64,65,66,67])); > >> tmp = char(fread(u, u.BytesAvailable,'char'))' > > tmp = > > ??A @ABC > > >> whos > Name Size Bytes Class Attributes > > tmp 1x10 20 char > u 1x1 242 udp > > >> uint8(tmp) > > ans = > > 161 160 65 0 0 0 64 65 66 67 > > It seems OK and I hope it will work. Thanks for your help. |