LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sample data

I am trying to design a VI that will work as in the attachment. I keep getting errors when I connect the indicators and  array indicators to the FOR LOOP.

Also I am at a complete loss as to how to configure the workings inside the VI to process if each element from the input array is greater than or equal to zero or less than or equal to five. Any promts to help me get started would be appreciated.

 

Regards,

Kadeel 

 

0 Kudos
Message 1 of 5
(2,743 Views)

clarify:

 

1. greater than or equal to zero

2. Less than or equal to 5.

 

both conditions are almost the same.0,1, 2,3,4,5 meet both conditons.

 

So do  you mean :

1.less than or equal to zero,

2. Less than or eqaul to 5.

0 Kudos
Message 2 of 5
(2,738 Views)

Kadeel wrote: greater than or equal to zero or less than or equal to five.

If you want to use the inrange/coerce block, you'll want to right click on the "in range and coerse" block and set it to include the upper range and lower range, not just the lower range as you have it set now.

 

Looking at the code blocks you have, you want

number of over shoots (and their indexes)

number of under shoots (and their indexes)

 

Here is an alternate way  (but probably not the most efficient) of doing it.

You could have 2 arrays coming out of the for loop.

 

if (value in)>5, then that index in one array gets set as one, otherwise 0

 if (value in)<0, then that index in the other array gets set as one, otherwise 0

 

The sum of the values in each array (add array elements block) will give you the total number of over/undershoots, and the 1s in each array will be in the locations of the index where the over/undershoot is.

 

 

Another way is to output the iteration number to each of the arrays depending on whether it is >5 or <0.

This will then give you two arrays containing the indexes of the under/overshoots and the number of elements in each array will give you the number of over/undershoots

 

0 Kudos
Message 3 of 5
(2,715 Views)
The attached seems to work, in a very very rube goldbergy way.
0 Kudos
Message 4 of 5
(2,703 Views)

Actually I may have misunderstood your question... 😞

0 Kudos
Message 5 of 5
(2,698 Views)