LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

if time = 3 seconds, how do i set the values of the time steps 0,0.1,0.2,0.3,0.5,1.0,1.5,2.0,3.0,5.0 to -9999 from time =3 seconds

Hi
 
I have 18 inputs (arrays) which contain certain statistics and if time  = 3 seconds, set the values of time step 5.0 to -9999.0.
 
I was wondering if there is an efficient way to do this without using a lot of case statements?
 
Thank you.
0 Kudos
Message 1 of 6
(2,867 Views)
Hello AdrianT,

it's not really clear to me what you want to do...
I suspect: you have an array containing values and you want to output them with a fixed timing of 3 seconds: you should use a for loop autoindexing trough your array and sending the value to your indicator/output/whatever. Put a "wait for next multiple" into your for loop.

Or do you want to have a minimum time delay of 3 seconds? Again use a for loop, get the time value and use a InRange&Coerce with minimum set to 3 seconds...

Or you should explain more precisely what you need...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,862 Views)

Hi

Thanks for that.

Let me explain.

 

The time may vary. Let me give an example. if time  = 2.1, I want to set the time step's  3.0 and 5.0's values to -9999.0.

if the time =0.1 seconds then I want to set 0.2,0.3, 0.5 etc values to -9999.0

etc ....................................................................

 

Can you please help?

Thank you.

0 Kudos
Message 3 of 6
(2,858 Views)
Hello TUDS,

do you use different accounts/nicknames ?

Well, that's easy, at least for a sorted array:
Search for your time-value in the array (Threshold 1D array). Fill all elements from that index till the end with your "error condition" (-9999).
For filling the array you can do: calc how many elements have to be written, "initialize array" with -9999 and number of elements, "replace array subset" with initialized array starting from index. This way you don't need a for loop.


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(2,856 Views)

Hi

Thanks for that.

 

But I  was wondering, How do i replace the first 3 rows of an array filled with -9999.0?

 

Thank you.

0 Kudos
Message 5 of 6
(2,833 Views)
Hello adrianT,

first you asked for filling all elements in an array starting from a given index (=element to be searched).
Now you ask to fill the array up to that index:

It's more or less the same: find the index of the given element, make a for loop and replace all elements from start to that index (or index-1, and don't forget to use a shift register). Or as I mentioned above: create an array with "Initialize Array" with the needed number of elements and replace all elements in one step.

You speak of "rows"? Do you have a 2d-array or a 1d-array? (Well it's nearly the same, you just have one index more to keep an eye on...)


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(2,821 Views)