05-30-2015 12:37 PM
Hello everyone,
I have a program that adds up multiple waveforms and displays them all together as one distorted curve in a single waveform graph.
I've had to add them all together using simple add functions, since the compound arithmetic block doesn't work.
Why would this be the case? Isn't it essentially just doing multiple additions in a convinient way? I've attached a VI with a simple example to show what I mean.
fr00tcrunch
Solved! Go to Solution.
05-30-2015 01:09 PM
Waveforms have timing information. What if the timing is different? You need to somehow throw an error. The Add has that capability. The Compound Arithmetic function does not have that in it arsenal.
05-31-2015 10:40 AM
Ah, thank you! Learning something new about LabVIEW every day.
Is there a simpler way to add multiple waveforms than the method I've used in my example VI?
I can imagine it being possible by using shift registers and a loop, but I don't really have much experience with shift registers yet.
05-31-2015 10:51 AM
If you have an array of waveforms, I would use a shift register on a FOR loop to add the waveforms together. Learn to use shift registers. They are a very VERY important construct in LabVIEW.
05-31-2015 12:26 PM
Okay so I fiddled around a bit with a for loop and shift registers and im pretty sure I came to the same result.
One thing I'd still like to ask is: How do I initialise the shift register using a constant? I can see how to put the dt value into the constant, but the attributes box is just a white square. It gives me a timing error when I try to do this and only works when I use an additional sine waveform block.
I've attached the updated VI to the post.
05-31-2015 01:17 PM - edited 05-31-2015 01:17 PM
1. No need to wire up the N. The autoindexing will tell how many iterations to perform.
2. Use Delete From Array to remove one of the waveforms from the array. Initialize the shift register with the deleted portion.
05-31-2015 01:31 PM - edited 05-31-2015 01:31 PM
Oh snap, that's great!
So many useful functions in LabVIEW, impossible to learn all of them so quickly.
Thanks again for all the help.
06-02-2015 09:48 AM
One more thing, how do you get that cut-out screen shot of the function block like you did in your last post?
06-02-2015 09:52 AM
@fr00tcrunch wrote:
One more thing, how do you get that cut-out screen shot of the function block like you did in your last post?
The Code Capture Tool is an amazing add on everybody should have. It is available through the LabVIEW Tools Network.
06-02-2015 09:54 AM
Wow, fast response, thanks 🙂
Yes it is amazing, I'll look into it now!