03-25-2013 03:50 AM
Hi,
Is there a faster way to calculate this common mode rejection...? I have een EEG signal (the first 64 channels) and they have to be added and devide through the number of available channels and then subtracte from the signal. See picture:
Best regards,
Thijs Boeree
Solved! Go to Solution.
03-25-2013 02:15 PM - edited 03-25-2013 02:15 PM
Have you tested this? When you add two arrays of different lengths, the result has the same length as the shorter input array. Since the input to the shift register is an empty array the output is also empty.
All that processing on empty arrays is actually pretty fast because the compiler optimizes away much of the code.
When I initialize the shift register with an array of the same length as the array being added, this code is slightly faster than a few other things I tried.
Lynn
03-25-2013 02:46 PM
I'm curious if you actually need the FOR loop at the end or if the native function will handle it. It is generally faster to let the native functions do their work with arrays instead of using explicit loops. You may need a Transpose Array in there to make it work.
03-26-2013 02:36 AM
Ah you're right, i have to initialize a 1D array first. but i don't know a better a way to add a 1D array and a 2D array without using a for loop...? Is there?
Regards,
Thijs
03-26-2013 03:47 AM
You can use the funtion "Initialize Array" available in array pallette to initialize a 1D or 2D array without using for loop.
03-26-2013 07:00 AM
Here are two other ways , which one is faster? It's up to you to test it 🙂
03-27-2013 02:59 AM
Hi,
The examples you are giving are with 1D array's but i have 2D array's, i have a 2D array with let's say 107 channels (columns) and 40 samples (each channel (rows)).
Now i have to add all the single samples of each channel and then devide them through the nummer of channels and subtract the outcome of each channel.
See here:
Best regards,
Thijs
03-27-2013 04:33 AM - edited 03-27-2013 04:35 AM