MVN streaming into MATLAB

Xsens has added example MATLAB scripts that receive streamed data from MVN to the MATLAB developer toolkit. These scripts are only examples and need to be adapted, adjusted or implemented by the user to fit the purpose that the user would like to apply them to. 


Install the Developer toolkit

Download the developer toolkit: (



After installing the the developer toolkit you can find the example scripts under:

C:\Program Files\Xsens\Xsens MVN Developer Toolkit 1.0.7\Matlab\Streaming


Get Started

To understand the first steps to use these scripts please take a look to the tutorial video:





In this folder you will find 5 different files:

- mvn_stream_example_jointangle.m: main script to run if joint angles want to be streamed.

- mvn_stream_example_position.m: main script to run if segment position and orientation want to be streamed.

- parse_jointangle_packet.m: function that decodifies the message from joint angles stream in MVN.

- parse_position_packet.m: function that decodifies the message from position + orientation(quaternions) stream in MVN.

- judp.m: function to read messages that are written in a certain port of the network. (Kevin Bartlett (2020). A simple UDP communications application, MATLAB Central File Exchange. Retrieved May 1, 2020.)


Choose the right stream in MVN

The example scripts are only implemented for the 2 streams shown below:

If using Position + Orientation (Quaternions) in MVN, run the mvn_stream_example_position.m, which will use the parse_position_packet.m.

If using Joint Angles in MVN, run the mvn_stream_example_jointangle.m, which will use the parse_jointangle_packet.m.

Make sure that the Send pause is not checked. 




Implement new streams in MATLAB

If different streams than the one that are given as example want to be implemented, it is possible to adapt the examples provided. 

Each stream is composed of a Header and then the Pose data. 


  • ID String - identifies the UDP datagram as containing the motion data of the format according to this specification. The last two digits determines the message type, which corresponds to the streamer selected in MVN.
  • sample counter - counts the number of UDP messages read.
  • datagram counter - number of UDP datagrams sent
  • number of items - number of segments, joints or points
  • time code - contains the time of the frame from the clock in MVN in milliseconds.
  • character ID - it indicates the id of the character to which the motion data belongs to


The pose data varies according to the streamer selected in MVN. To have a better overview of the data provided for each pose, please read the manual below:


The main function that needs to be adapted to read the data sent by the streamer is the parse function. This function will decodify the message sent. 

1 - The first thing to verify it is the output of the message. Depending of the type of message stream different variables can be output. 

2 - The size of the packet can also be different, since some packets have more data than others. You can find the size of the packet in the manual in the description of each packet.


3 - Finally the conversion of the bytes into numbers can also change between streamers since certain type of data is codified in different ways. You can find the different conversions in the manual in the description of each packet.






Was this article helpful?
0 out of 0 found this helpful
Do you have a question? Please post your question in our Community Forum