07-12-2013 05:07 AM
I run in to a weird problem when trying to create a SubVI that would check if an input 1D-array of U32 numbers is in strictly ascending order in regards of the index. An output boolean is true if that is the case (Maybe there is an easier way to check?)
When I hit the Run Continuously button to check it out, it seems to work for the most of the time, but occasionally I get a true value even though the elements are clearly not ascending or have identical values.
In the attatched image I've put probes on the wires to see what values they have. As you can see the element on index 4 is -2 and 1 respectively. The Greater or Equal-function is set to compare aggregates but it still says that -2 >=1 is true?
Is there a problem with old data still in memory or something?
Thanks in advance
Oscar
Solved! Go to Solution.
07-12-2013 05:48 AM - edited 07-12-2013 05:51 AM
07-12-2013 05:56 AM - edited 07-12-2013 05:59 AM
Hi Oscar,
As Gerd mentioned this is happening as you are using the comparison mode as aggregate. In the mode it will compare the aggregates of two arrays and not each individual element. If you want to check each element with this function, right click the '>=' function and select comparison mode as Compare elements. Then you'll get the comparison results of all the elements as an array. You can AND this array and get the required status.
warm regards,
Nitz
(Give Kudos to good Answers, Mark it as a solution if your problem is Solved;))
07-12-2013 06:08 AM - edited 07-12-2013 06:22 AM
Oh swag, clearly more neat! I don't even care that I don't really gets what was wrong with my solution. Compare elements it is from now on (:
EDIT: Although I guess to get a check for strictly ascending we'd have to replace Greater or Equal? for just Greater?
07-12-2013 07:38 AM
07-12-2013 07:46 AM
Hello Gerd,
Is it "x greater AND equal y" or "x greater OR equal y"
regards,
Nitz