Search code examples
c#matlabbluetoothserial-portreal-time

How to get real time data collected from a serial port in C# and use it in MATLAB?


More specifically, I'm collecting, from a 9-axis sensor, 4 Quaternion values,sending them via Bluetooth to a dongle connected to the PC, and hoping to fead them to MATLAB where I have a sphere that shall rotate with the same manner as the sensor(I should end up with something similar to the Teapot application). I have an application in C# that deals with reading the data from the serial port, but I was wondering where should I put the values that I get to ensure real time accuracy? Should I put them in a file and read the file from MATLAB, or is there any other way to stream the data to MATLAB? Thank You


Solution

  • First of all: Real time is not possible. You are using windows, it's not a real time operating system.

    You could create a .NET-Library from your code and call it from matlab, explained here