MATLAB Answers

Sending Different Sized Integers together over TCP/IP

1 view (last 30 days)
Stephanie
Stephanie on 23 Jul 2013
I need to send a data packet in binary to a remote device via TCP/IP. The data packet format consists of a series of 8 bit unsigned integers and 16 signed integers that need to be sent together in twos complement representation. I am using fwrite to send binary data to the device. However, I can only write with one type of precision at a time. Are there other commands which I can use to send these different precision types together in one packet?

  0 Comments

Sign in to comment.

Answers (1)

Nathan Crosty
Nathan Crosty on 23 Jul 2013
Edited: Nathan Crosty on 23 Jul 2013
You might look into "packing" your values of different types using a structure and sending that, then of course unpacking them on the receiving end.

  0 Comments

Sign in to comment.

Sign in to answer this question.