Data Rate and Data integrity

Legacy support with Phidget21
Fresh meat
Posts: 1
Joined: Mon Mar 19, 2012 12:58 pm

Data Rate and Data integrity

Postby snoobs » Mon Mar 19, 2012 1:11 pm

I'm trying to integrate the use of Phidgets with some Matlab code that I have.
I'm using the 1056_0 spatial 3/3/3 and running Matlab 7.10.0 (2011b) on a windows 7 machine.

Within the Matlab code, I have a loop where I am polling the spatial for acceleration/gyro data. The other functionality in the loop causes each cycle to have a different elapsed execution time so I can't really align the data rate of the spatial with the speed of the loop. This is leading to data integrity issues when the loop takes too long (and misses data packets from the spatial) or when the loop is too quick (and receives redundant data from the spatial)

I'm looking for a way to resolve this and was going to try and use a SpatialEventData struct since it at least has a timestamp but don't even know how I would incorporate this into Matlab code.

Any advice on how I can sync up the data rate so that I'm not missing/double counting data or an example of using the SpatialEventData struct in matlab would be greatly appreciated.


Posts: 268
Joined: Thu Nov 19, 2009 4:41 pm

Re: Data Rate and Data integrity

Postby fraser » Mon Mar 19, 2012 3:08 pm

events are not possible since there are no function pointers in MATLAB, so you will have to use the polling method.

User avatar
Lead Developer
Posts: 3141
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada

Re: Data Rate and Data integrity

Postby Patrick » Fri Mar 23, 2012 2:50 pm

To use events in Matlab you would have to write a MEX program in C, that will open the Phidget and set up events and queue up the event data as it comes in, and then receive the queued data into Matlab via a MEX function call as an array.

We don't have an example for this.


Return to “Matlab”

Who is online

Users browsing this forum: No registered users and 1 guest