Skip to main content
Tweeted twitter.com/StackArduino/status/1425426793134280711
Fixed syntax highlighting, added tag.
Source Link
VE7JRO
  • 2.5k
  • 19
  • 28
  • 31

I'm trying to get some binary data from an Arduino Due to Matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);
byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab side, I open the corresponding COM port and use a command like this one:

 a = fread(serialPort,3)
 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49
 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

I'm trying to get some binary data from an Arduino Due to Matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab side, I open the corresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

I'm trying to get some binary data from an Arduino Due to Matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab side, I open the corresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

improved formatting, spellling and punctuation and removal of noise
Source Link
SoreDakeNoKoto
  • 2.4k
  • 2
  • 14
  • 23

I'm trying to get some binary data from an Arduino dueDue to Matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab siteside, I open the corresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

I'm trying to get some binary data from an Arduino due to Matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab site I open the corresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

I'm trying to get some binary data from an Arduino Due to Matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab side, I open the corresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

improved formatting, spellling and punctuation and removal of noise
Source Link

I'm trying to get some binary data from an arduinoArduino due to matlabMatlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab site I open the coorespondingcorresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.writeserial.write sends binary data and freadfread reads binary data.

Thanks & Greetings

I'm trying to get some binary data from an arduino due to matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab site I open the cooresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

Thanks & Greetings

I'm trying to get some binary data from an Arduino due to Matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab site I open the corresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =

    49
    49
    49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

Source Link
Loading