03-13-2012 05:08 AM
Hi All
I know you read these words a lot here ,sorry ,I'm new to labview and I want someone to help me out in the vi that I'm going to explain now.
I have a while loop with a variable inside it (local variable or a random variable in this example),the loop has wait time of 1000ms ,so every one second there's a new value .
after an amount of time I want to record what the variable outputs into an array ,and then sum up all of these values and then display them.
I will trigger the recording process manually using a boolean trigger so ,no need for a timer or something ,i will just press a button then values start to accomulate in the array and then when I release the button ,I want these values to be summed up and displayed ,Then I have another RESET Boolean ,that I press to reset the values in the array back to zeroes in order to press the button one more time again later and then the process repeats itself again.
I made the vi in the way that i'm posting right now that i can only begin the vi so values accomulate and then when i press the boolean button the loop stops and then the array is summed up and displayed.
the problem is that i can't reset the values or repeat the process again because when i press the boolean ,the loop stops and i can't start it over once again.
I will be very thankful if someone helped me out with that.
Thanks in advance
Regards
Shady
Solved! Go to Solution.
03-13-2012 05:48 AM
Have a look on the attached VI, let me know if you need any changes.
03-13-2012 05:58 AM
You can try the following method.
Good luck
03-13-2012 06:10 AM
Hey shady,
It is always advisable to use shift register for building arrays. Using a while loop within a Case Structure is not a good programming practice. Check out the attached VI. This must help you.
Warm Regards,
NitZ
(Give Kudos to good Answers, Mark it as a Solution if your problem is Solved;))
03-13-2012 06:21 AM - edited 03-13-2012 06:22 AM
But still this may decrease the performance as explained Here.
03-13-2012 06:31 AM
Anand,
Thanks for pointing this out. I was thinking of it while coding this, but then felt that it will be a bit confusing for shady to use all the reverse functions and all initially. Anyway, thanks again.:)
Regards,
Nitz
03-13-2012 08:36 AM
Puneet K
Thanks a lot for the example VI ,It took me a while to figure out how those booleans array work 😄 ,but yeah finally i got it .
Thanks again
Regards,
Shady
03-13-2012 08:38 AM
P Anand
Thanks a lot ! ,The simplest and fastest solution to my problem 🙂 ,although it doesn't have the reset button ,but the same function can be obtained when release the boolean "capture".
Thanks a lot again !! 🙂
Regards
Shady
03-13-2012 08:39 AM
NitzZ
You got what I meant exactly ,the solution is perfect and also easy for me to understand ,thanks a lot man 😄 .
Thanks again
Regards
Shady