ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build arrays then reset

Solved!
Go to solution

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.

 

untitled.JPG

 

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

 

 

0 Kudos
Message 1 of 9
(4,247 Views)

Have a look on the attached VI, let me know if you need any changes.

Message 2 of 9
(4,230 Views)

You can try the following method.

 

Build Arrays 1.png

 

Build Arrays 2.png

 

Good luck

-----

The best solution is the one you find it by yourself
Message 3 of 9
(4,222 Views)
Solution
Accepted by topic author shadymohamed

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.

 

Untitled.png

 

Warm Regards,
NitZ

(Give Kudos to good Answers, Mark it as a Solution if your problem is Solved;)) 

Message 4 of 9
(4,212 Views)

But still this may decrease the performance as explained Here.

-----

The best solution is the one you find it by yourself
Message 5 of 9
(4,205 Views)

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 

0 Kudos
Message 6 of 9
(4,201 Views)

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

0 Kudos
Message 7 of 9
(4,182 Views)

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

0 Kudos
Message 8 of 9
(4,180 Views)

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

0 Kudos
Message 9 of 9
(4,177 Views)