07-01-2019 08:41 AM
Hello,
For a program I am creating I need exactly 16384 data points of a current waveform. This is a strange number but is a requirement for a VI from a driver for a function generator. I have many csv files of waveforms that I would like to use. However, some of the waveforms have more and some of them have less than this number of data points. Therefore, if there are more data points, I want to cut off and extract only the first 16384 data points and use those. When there are less, I want to just add zeros after the last data point until I have enough of them. I then need to put this data back into a csv file as that is what the function generator VI takes as an input. What are some of the best ways to do this?
Thank You
Solved! Go to Solution.
07-01-2019 08:45 AM - edited 07-01-2019 08:47 AM
07-08-2019 09:32 AM
Hello,
I was able to figure out my question on my own but thank you for the response!
07-09-2019 04:51 AM
@GerdW wrote:
Hi lucasphee,
to ensure exactly 2^14 elements in your array you could append 2^14 zero elements to the input array, then uase ArraySubset to take the first 2^14 elements:
A reshape array would bot shrink and grow an array to that size:
The 'fill value' can't be set though.
07-09-2019 04:51 AM
@lucasphee wrote:
Hello,
I was able to figure out my question on my own but thank you for the response!
Others could benefit from your solution. Please post it.
It help if you accept a (your) solution. It keeps the forum clean...
07-09-2019 07:16 AM
To get the first n elements all I had to do was use the Array Subset and connect the number n to the length input. The output was the first n elements of the array.
07-09-2019 07:22 AM
@lucasphee wrote:
To get the first n elements all I had to do was use the Array Subset and connect the number n to the length input. The output was the first n elements of the array.
Thanks for posting and accepting a solution!
Keep in mind that this method will only shrink the array. If that is your situation, it is indeed the simplest and best solution.