ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

remove items from 1-d array

Solved!
Go to solution

I get 'target' as the deleted portion fine. It's just that instead of it being deleted from the array I get an array where it is replaced by a second copy of the smallest member of 'used odors'.

0 Kudos
Message 11 of 23
(2,045 Views)

The 'target' value must be identical to a value in the "used odors" array to be found by the "search 1D array" VI

 

0 Kudos
Message 12 of 23
(2,044 Views)

@NeilR wrote:

They will be if the 'target' value cannot be found in the "used odors" array.

In that case an invalid value of -1 will be passed to "delete from array" Smiley Wink

 

 



Interesting.  I didn't expect a -1 to not "delete from array".  It actually didn't put a smallest value in.  It put a zero at the front.  And the array isn't the same size, it is one element longer.

0 Kudos
Message 13 of 23
(2,038 Views)

 

I just have an array of numbers for "used odors" > 3,4,5,6,7 and enter 77 as the target.

 

The "array w/ subset deleted" becomes 3,4,5,6,7 no deletion ... but no addition either ?

 

0 Kudos
Message 14 of 23
(2,030 Views)

If I understand what you want, you just want an array with the number equal to "target" removed? Am I correct in this understanding? If so, here are two ways to do it. I don't know if autoindexing does inplaceness in 2013, never bothered to benchmark again, but I think it was supposed to be optimized.

 

 

 

0 Kudos
Message 15 of 23
(2,028 Views)

Simpler, put the Delete from Array in a case structure with the DFA in the true case.  In the false, just wire the array through.  Use a >=0 on the index from search from array to control the case structure.

 

And if your values are integers, stop using a double data type!

 

I still don't see how you get the results you say you are seeing.

 

ATTACH YOUR VI WITH DATA!

0 Kudos
Message 16 of 23
(2,019 Views)

 

I still don't see how you get the results you say you are seeing.


 

Indeed.  Bizarre !

 

 

0 Kudos
Message 17 of 23
(2,014 Views)

I think this has the data.

 

Anyhow, odors used = [3 5 9 14 1].

Target = 5.

the array with deleted element  is [1 3 9 14 1]

0 Kudos
Message 18 of 23
(2,013 Views)
Solution
Accepted by DRLV

Your Index on the "used odor" control is set to 1 rather than 0 !!!!!!!!!!

This hides another value Smiley Very Happy

 

0 Kudos
Message 19 of 23
(2,003 Views)

Check your control.  It is [1 3 5 9 14 1].  You just have the index set to show element 1 instead of element 0,

 

It works just fine.  (But still make it integers instead of doubles.)

0 Kudos
Message 20 of 23
(2,001 Views)