LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete five values after "0" in array

Hi,

i have array of number:

 

51,9
51,9
51,9
0,0
0,0
0,0
200,0
172,2
158,4
52,4
51,7
51,3
51,1
51,0
51,0
0,0
0,0
0,0
0,0
0,0
51,3
51,4
51,4
51,5
51,7
51,7
51,8
51,9

 

and i wanna delete some values after "0,0".

Im working with LV 7.0

 

Any help will be sincerely appreciated.

 

Thanks.

 

 

0 Kudos
Message 1 of 9
(2,599 Views)

What have you tried so far?

Are those zeroes real data or just markers?

 

Your problem has 2 components. First, you need to find the zeroes. Search 1-D Array might work for you except that with floats you're going to want to use an In Range search.

Deletion is pretty straightforward using the Delete from Array function.

 

You'll probably want to do this in a loop with shift registers.

0 Kudos
Message 2 of 9
(2,586 Views)

Those zereos are real data.

 

For now I tried with function "In Range and Coerce".

 

Tnx

0 Kudos
Message 3 of 9
(2,570 Views)

Do you also want to delete the zeroes themselves?

 

In your example, what would the desired output array look like?

 

Comparing your title and your text, it seems that some=five. Is this correct?

 

ISo the zeroes are "real data", are they true zeroes or could they also be very small numbers very close to zero?

0 Kudos
Message 4 of 9
(2,564 Views)

Hi,

 

No, i wanna keep the zeroes. They are true zeroes.

 

Comparing your title and your text, it seems that some=five. Is this correct?  Five or more than five.

 

My array someday will look like this:

 

 

Have:

 

51,9

Wanna have:

51,9

51,9 51,9
51,9 51,9
0,0 0,0
0,0 0,0
0,0 0,0
200,0 0,0
172,2 0,0
158,4 0,0
52,4 0,0
51,7 0,0
51,3 51,3
51,1 51,1
51,0 51,0
51,0 51,0
0,0 0,0
0,0 0,0
0,0 0,0
0,0 0,0
0,0 0,0
51,3 0,0
51,4 0,0
51,4 0,0
51,5 0,0
51,7 0,0
51,7 51,7
51,8 51,8
51,9 51,9

 

 

I wanna delete five or more values in array after last zereo value.

 

Tnx

 

0 Kudos
Message 5 of 9
(2,549 Views)

OK, so you don't want to delete them, but replace them by zeroes, keeping the array szie the same. that a big difference and actually makes thing simpler. What have you tried?

 


@ant_inter wrote:

I wanna delete five or more values in array after last zereo value.



Computers need clearer instructions, so the "or more" is ambiguous. How is the program supposed to know how many. Is the actual number an input to the program?

0 Kudos
Message 6 of 9
(2,539 Views)

Hi.

I appologize for bad explanation.

 

>> OK, so you don't want to delete them, but replace them by zeroes, keeping the array szie the same. <<

Yes I wanna replace them with zereos and keep array in same size.

 


For now I didnt do nothing useful. Im workink with "Search 1D Array" and with  "Replace Array Subset" functions.

 

Yes. Number is input (control)  to the program.

 

Thanks again

0 Kudos
Message 7 of 9
(2,526 Views)

As long as they are true 0, use Search 1D Array to find the first 0.  From there check each item and compare it to 0.  If it is 0, go to the next.  If it is not 0, then use Replace Array Subset with that index.  For the values to replace with, use Initialize Array with 0 as the value and your input number as the array size.


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 8 of 9
(2,503 Views)

Try something like this (should be sufficient unless the arrays are gigantic).:

 

 

 

(false case is simply wired across)

0 Kudos
Message 9 of 9
(2,483 Views)