Sensors, Electronics and Prototyping

Reply To: Matlab Communication

Welcome to Redshift Labs Forums UM7 Product Support Matlab Communication Reply To: Matlab Communication

Manish Mittal

Hi Caleb,

I was able to get the Euler Angle Data from the sensor using the MATLAB example code written by you. Now I want to store it in a variable matrix so that I can use it for further calculations. I used the Userdata attribute of the callback. function object to store the data. I did something like:

gyro_x = typecast( flipud(uint8(, ‘int16’ )/100;
gyro_y = typecast( flipud(uint8(, ‘int16’ )/100;
gyro_z = typecast( flipud(uint8(, ‘int16’ )/100;

h1 = [gyro_x, gyro_y, gyro_z];
h = [h; h1; h1]
obj.Userdata = h;

I thought that it would return an ever-increasing (number of rows will continuously increase storing the real time data) matrix with the gyro_x, gyro_y, gyro_z values. But the Userdata matrix has just one row which contains the latest values of the three variables. Its like its just updating the last row after each loop run. I am not sure if I am doing anything wrong. Can you please tell me know if there is anything wrong or if there is any other way to store the real time data from the callback function in the base workspace for later usage.