04-09-2014 10:57 AM
Hello,
I am having trouble using the formula node while indexing my two arrays. I keep getting "NaN" for my output array. I believe the problem lies within my shift register. My guess is that for the first calculation there is not a PreviousAngle so that is why it is giving me "NaN." For the first index I would like the value of the PreviousAngle to be 0. I am new to LabView and unsure what to do.
Thanks!
Christian Seymour
Solved! Go to Solution.
04-09-2014 11:04 AM
04-09-2014 11:04 AM - edited 04-09-2014 11:12 AM
The shift register should contain 0 by default since you are using a double [if uninitalized, the shfit register takes the default value of the data type. In this case, the default Double is 0], but you should explicitly initalize the shift register to a default value in most cases.
To do so, right click on the "previous angle" shift register and select "Create constant". This will create a Double value of 0 to fill in the register for the first calculation.
If you need a number other than 0 to start, you can just change this constant.
**Note: This is a good habit to have. Shift registers retain value as long as the VI is in memory. So if you run this more than once, it will have the value from the last execution automatically! This is usually unintended behavior for new LabVIEW users -- however you can sometimes take advantage of this feature in some applications and make it intended behavior 🙂