03-31-2016 04:43 PM - edited 03-31-2016 04:49 PM
Hi Josh,
- use a wire branch of your input array connected to the FOR loop border to enable autoindexing instead of ArraySize connected to the N terminal
- use the conditional break of the FOR loop to prematurely end the loop when no zeros are found! Why keep searching N-1 elements, when the N-th element didn't yield in a "found" zero?
Or, even more "Simple, quick, easy": use Christian's suggestion with a conditional output tunnel!
And keep in mind: comparing floats for equality may result in unexpected results…
03-31-2016 05:03 PM
First
@JoshStenzler wrote:
Simple, quick, easy.
Yes but prone to unexpected outputs as this thread has been discussing. Floating point precision equal comparison kills programs. Well sorta, not really it just does what you ask, and being unaware of the consequences could have issues. Be sure and read up on the topic, and understand the data you are getting, and you might be fine.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-31-2016 06:05 PM
@JoshStenzler wrote:Simple, quick, easy.
In addition to what has been said already....
Very, very inefficient. First of all, constantly resizing an array in a tight loop causes many expensive memory allocations.
You algorithm gets astronomically slow for large arrays O(NxN), because you start searching from the beginning over and over. You only need to start searching from where you left off, there is a start index input for that reason. Currently, you are inspecting the first element N times.
Back to the drawing board! Currently it is "simplistic, slow, and inefficient".