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.
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.
11-06-2019 01:07 PM
Currently, I have a for-loop running 10 iterations and with each iteration providing a random number within a set range. My goal is to graph these 10 numbers if they are within my range, but display some sort of arbitrary error message if they are above or below (ie. "Error! Value outside of acceptable range). I've been trying to use a case statement to achieve this, but have had no luck. Any help would be greatly appreciated. Thanks!
11-06-2019 01:15 PM
What have you tried? Please post code and someone can point you in the right direction
11-06-2019 01:39 PM - edited 11-06-2019 01:41 PM
Sorry, meant to add that to the original post. Currently I have the true statement going to one graph while the false goes to another (still haven't figured out the error message so this is my substitute). When running it however, it executes on both graphs on the front end. I thought my greater than and less than relations would restrict it to only run the "true" x were not greater than "32" and also not less than '20."
11-06-2019 01:45 PM
Are you using the Run Continuous button?
11-06-2019 01:48 PM
Nope, just running once, and each time both graphs are executed. I additionally tried changing the boundaries on the random number generator within the for-loop to ensure that it could only be within the range, and even then both graphs still executed when running it.
11-06-2019 02:18 PM
Since you don't initialize the graphs at the beginning, the one that is not accessed during any particular run will retain the values from the previous run. Is this what you are seeing?
11-06-2019 02:21 PM
Please post your VI. It is really hard to troubleshoot a picture.
11-06-2019 02:22 PM - edited 11-06-2019 02:27 PM
That doesn't make sense. Attach the actual VI.
Only one or the other can execute. I have severe doubts that your logic is going to work the way you want since you are working on arrays, than doing an AND Array
Elements on the arrays. Only if every value in the array is greater than 32 OR less than 20 will the True case run.
But the end result is going to be a True or False and only one of the graphs is going to get all the values.
11-06-2019 02:43 PM
@kjb123 wrote:
Nope, just running once, and each time both graphs are executed. I additionally tried changing the boundaries on the random number generator within the for-loop to ensure that it could only be within the range, and even then both graphs still executed when running it.
For more clarity in troubleshooting, go to VI options...execution.. and select "clear indicators when called". This guarantees that data in indicators is not retained between runs.
11-07-2019 05:53 AM
Thank you everyone for the input. I was able to get it to run how I wanted, sorry for any confusion as I am new to this program. Now that I know it is executing properly, however, I want to achieve my second goal of having the false display an error message rather than go to a different graph. I've been trying to use a 1 button dialogue as this seemed to be the simplest solution, but I cannot seem to find a way to convert so the types match up. Any suggestions? Thanks.