LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

not decreasing function

Hello.

I just started using LabVIEW so I'm really sorry if the question seems silly to some of you. But I'm really in need of help.

I'm supposed to make a sub VI that gets an array and gives back TRUE if the function is not decreasing and FALSE if it is decreasing.

I was only able to make a VI that checks every next element and gives answer for every next element (checks if the element is <= than previous) but can't put one answer as the final result.

Can you, please, help me?

0 Kudos
Message 1 of 11
(3,766 Views)

So every sample must be less than the previous?  If you have an array of all of the results (Booleans), then just use OR Array Elements (since TRUE means you are not decreasing) to get a single Boolean.  With an OR, if any of the results were TRUE, then the final result is a TRUE.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(3,752 Views)

I still don't understand how to make this array.

Every time the array of booleans only shows last value on every position.

I'll maybe try to attach a file, because I'm probably making some very stupid mistake, but I can't see it. 

 

EDIT:

 

Found the sollution, I'm sorry, Now I'm working on the last part.

 

Thank you for your help. I hope I won't have to ask no more of those silly (for you) questions 🙂

0 Kudos
Message 3 of 11
(3,730 Views)

No question is silly.  Sometimes just asking the question forces you to slow down and, suddenly, the answer is apparent.  When I "get stuck" with code that doesn't quite work, I'll frequently find some "innocent bystander" (a colleague or someone with, say, Matlab experience) and explain my problem to them.  Usually they'll say "But why do you think this has to be positive?", and I'll say, "Ooooh, I forgot to put in the Absolute Value function ...".  There are few things as valuable as "explain your code to someone else" for finding bugs.

 

Bob Schor

Message 4 of 11
(3,699 Views)

Also called Rubber Duck Debugging.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(3,674 Views)

If the current element is larger (or equal) than the previous element, and all previous elements have been checked in order in the same way, the current element will also be larger (or equal) than all previous elements. There is no need to create any boolean arrays (extra memory allocations can be expensive for very large arrays). Keep checking in an autoindexing conditional FOR loop and exit early if the test fails. The scalar output that was also wired to the conditional terminal will tell the overall result once the loop has completed.

 

 

If you set the comparison and stop condition correclty, the output will be the anwer directly

 

You are probably using a shift register to compare with the previous. If you initialize it with "-inf", you can autoindex on the array directly.

 

See if these ideas would simplify your code. 😄

 

For a more bulletproof subVI, make sure that it correctly handles inputs that are empty arrays or arrays that might contain some elements that are NaN.

0 Kudos
Message 6 of 11
(3,643 Views)

A very simple solution would use this code, followed by a suitable comparison (>0, <0, >=0, <=0, etc.), followd by "and/or array elements" depending on the desired logic. No loop needed.

 

0 Kudos
Message 7 of 11
(3,594 Views)

Mathematically your answer is Difference (dx) if it is negative you have  decreasing in your data and if it is positive you have increasing in your data and for zero you do not have change in data 
it is the fact that all friends want to tell you

also I try to show you answer on dynamic type data by using Difference (dX) vi in labview 

 

0 Kudos
Message 8 of 11
(3,563 Views)

Advanced LabVIEW user typically don't use express VIs and dynamic data. 

Your difference express VI receives more and more data without any upper limit. That's a lot of repetitive and unecessary work.

Afterwards you are throwing everything away and just keep one result when converting the dynamic data back.

Your shift register is uninitialized, thus the old day will not clear on the next run.

Your VI runs until stop is pressed, growing the array without bounds.

 

The original question asks for a subVI that takes an array as input and returns a boolean. Your VI does not do that.

Message 9 of 11
(3,540 Views)
altenbach you are right
i just try to show Mathematically what is your means about using that codes
i know that that vi could not be use as subvi
it just want to show Mathematics concept of your code
0 Kudos
Message 10 of 11
(3,523 Views)