Fast comparison of values in array

2 views (last 30 days)
Shane
Shane on 30 Jun 2014
Edited: Cedric on 30 Jun 2014
I am using a data acquisition card pulling in data at MHz rates. I am needing to do a comparison of this data and threshold it.
I.E. I have an array of 10,000 variables. I want to find all values less than 50 and set equal to one and everything greater than or equal to 50 as 0.
But I want to continuously do this over and over, as fast as possible. I am current just doing
myResults = data < threshold;
Is there anyway to do this faster? Are there maybe specific sizes of the array that would be faster? Or is there anyway fancy way to make it faster?
It seems to be non mulch-threaded, anyway to make it take advantage of multiple CPUs?
  1 Comment
Matt J
Matt J on 30 Jun 2014
It should be multi-threaded already. 10000 isn't a very big data size, though, and that may be why you don't see MATLAB firing all thrusters. You should gather a bigger data set before thresholding.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!