Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

signal split multiple times on RT target

Solved!
Go to solution

Hello,

 

 

I have a signal composed of 50.000 elements on my RT cRIO and i want to split this signal into 97 signals of 512 elements each. Is there a way to implement this using Labview Blocks? So far I implemented it using a MathScript and a for loop but the program is working very slow because of that.

 

 

 

Thx,

Valentina

0 Kudos
Message 1 of 5
(5,512 Views)

What data type is your signal in at the moment (waveform? 1D array?)

 

How do you want to split the 50 000 points - do you want the first 512, then the next 512, or is your data interleaved somehow so that you want (0, 97, 194...), (1, 98, 195...) or something else?

 

What data type do you want the 97 signals to be when you've split them - 2D array (97 x 512), 1D array of waveforms, something else?

0 Kudos
Message 2 of 5
(5,488 Views)

My data type at the moment is 1D array. I want to split this signal into 97 signals, each of 512 elements. My data is not interleaved, i just want to take the first 512 elements and make a separate array with them, then the next 512 and so on. The data type i want to have for the splitted signals is also 1D array.

0 Kudos
Message 3 of 5
(5,485 Views)
Solution
Accepted by topic author valentina.alina

Here's a snippet with two ways of doing this - assuming you want to operate on your 97 subarrays one after another and not break them out into 97 different wires on the same diagram, which would be unwieldy to say the least!

 

The first one uses Split 1D Array in a while loop with a shift register, and Empty Array? from the comparison palette to determine when to exit the loop. The second one uses Reshape Array and a For loop with auto-indexing enabled - I'm not expert on this but I think the compiler might be able to paralellise that better, if performance is an issue.

 

Note that if your input array is not an exact multiple of 512 points then the first solution will give you a short array at the end while the second one as it stands will ignore the last <512 points - you'll need to modify whichever one you use if that isn't what you want.

 

split array demo.png

Message 4 of 5
(5,477 Views)

Thank you very much Smiley Very Happy

0 Kudos
Message 5 of 5
(5,474 Views)