From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to efficiently create a single waveform based on data from two other waveforms?

Solved!
Go to solution

 

I have a 1-D array of waveform with size = 4 that contain "raw" potentiometer voltage data.  I need to manipulate waveform data from index 0 & 1 using the formula shown below to derive a single waveform of angle data.   I need to do the same for index 2 & 3 as this is a redundant circuit.   I was hoping that the formula node can work on entire arrays and although it can take an array as input, it requires me to index the array in the formula so it becomes a scalar value.  

 

Since the formula is relatively complex, I'd like to keep it in text form but have it automatically work on each point of the two input arrays.  This math is done inline with pulling data out of a DAQ and so I need it to be as efficient as possible so that I don't spend too much time on it and potentially overflow the DAQ buffer. 

 

The naive solution would be to wrap the formula nodes with for loops, but I don't know if this is this is an efficient way to do this.  I would appreciate any suggestions on how best to tackle this.  

 

Thanks!

 

 

 

wavefrm_manip.png


0 Kudos
Message 1 of 2
(2,063 Views)
Solution
Accepted by topic author SeanDonner

Here's how I would do it with no formula nodes or loops requied:

waveform angle.png

 

If you want to use the formula node, then you could run a loop inside each formula node while you index through the arrays.  The performance difference between formula nodes and the graphical approach should be insignificant.  Note that my approach assumes that the array sizes are the same.  You could also create a sub VI to contain the math so you don't have to maintain two copies of the same piece of code.

 

Chris M

Message 2 of 2
(2,049 Views)