キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

remove items from 1-d array

解決済み
解決策を見る

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 件の賞賛
メッセージ11/23
2,261件の閲覧回数

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

 

0 件の賞賛
メッセージ12/23
2,260件の閲覧回数

@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" スマイリー ウインク

 

 



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 件の賞賛
メッセージ13/23
2,254件の閲覧回数

 

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 件の賞賛
メッセージ14/23
2,246件の閲覧回数

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 件の賞賛
メッセージ15/23
2,244件の閲覧回数

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 件の賞賛
メッセージ16/23
2,235件の閲覧回数

 

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


 

Indeed.  Bizarre !

 

 

0 件の賞賛
メッセージ17/23
2,230件の閲覧回数

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 件の賞賛
メッセージ18/23
2,229件の閲覧回数
解決策
受理者 DRLV

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

This hides another value スマイリー とてもハッピー

 

0 件の賞賛
メッセージ19/23
2,219件の閲覧回数

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 件の賞賛
メッセージ20/23
2,217件の閲覧回数