05-24-2015 11:38 AM
Hi,
I want to load into memory series of thermograms. The thing is I can get all of them (180) read although I need to improve/compare the results of FFT performed on them - so I want to 'change the sampling frequency' so I will load every 2nd, 3rd, 4th,.. 9th termogram. That would be chosen by the user.
How am I supposed to alter the 1d array of strings with paths so only every n-th element will be in output array? I attached the VI that gets coma as the first array element.
Michał
Solved! Go to Solution.
05-24-2015 12:00 PM
If I understand the question properly, you want a way to take a 1D array and get every Nth element as a second 1D array. There are many ways to do this, but one is to reshape the 1D array into a 2D array with N columns and use the contents of the first column (which will be 0, N, 2N, etc.). [You need to be sure N is between 1 and the size of the Array, of course ...].
Bob Schor
05-24-2015 01:28 PM
@Bob_Schor wrote:
If I understand the question properly, you want a way to take a 1D array and get every Nth element as a second 1D array.
One problem with the reshape function is that it allocates another array where most of it is thrown away right afterwards. I would probably go with something similar to this code.
05-24-2015 02:01 PM
With the new conditional tunnel, wouldn't it be easier to just feed the remainder into an Equals 0? and use that true/false as the tunnel condition to build the array that way instead of using multiple array functions to get the same result?
05-24-2015 02:44 PM - edited 05-24-2015 04:02 PM
@natasftw wrote:
With the new conditional tunnel, wouldn't it be easier to just feed the remainder into an Equals 0? and use that true/false as the tunnel condition to build the array that way instead of using multiple array functions to get the same result?
The explicit method is more efficient because the size of the output is exactly defined. With the conditional tunnel, the final number of elements is not known and thus cannot be correctly allocated in one operation.
Also, a Q&R operation is more expensive than a multipliucation. You could even do an addition in a shift register instead.