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

find a value in a boolean array

Hey I have a boolean array with 500,000 values and I need to find the only one thats true. Is there an easy way to find this value?

 

Thanks

0 件の賞賛
メッセージ1/25
10,588件の閲覧回数

Search 1D Array works fine with boolean arrays.

0 件の賞賛
メッセージ2/25
10,579件の閲覧回数

Search array?

 

Do you just want to find it (get the index) or do you also need to verify that there is only one?

0 件の賞賛
メッセージ3/25
10,576件の閲覧回数

@Neil_Helsel wrote:

Hey I have a boolean array with 500,000 values and I need to find the only one thats true. Is there an easy way to find this value?

 

Thanks


I don't understand this question.

Use boolean logic.

 

Or do you actually need the index of the value that is TRUE.

0 件の賞賛
メッセージ4/25
10,573件の閲覧回数

So far we assumed that you have a 1D array (you did not say!)

 

(In the more general case, this idea would help too, but it does not seem to get a lot of love. 😉 Only 16 kudos 😞 )

0 件の賞賛
メッセージ5/25
10,566件の閲覧回数

Define "find the only one that's true"

 

Does that mean detect that there is a true in the array?  Or you want to know the location of the true in the array? Are you searching a 1d array?

 

Search 1d array on the array pallet if you want to know the location if it is a 1d array.

Or Array elements if you just want to know if there is a true value in the array.

 

メッセージ6/25
10,560件の閲覧回数

@altenbach wrote:

(In the more general case, this idea would help too, but it does not seem to get a lot of love. 😉 Only 16 kudos 😞 )


Gosh, I do that all the time. +1 for sure.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 件の賞賛
メッセージ7/25
10,548件の閲覧回数

@_Bryan wrote:

Define "find the only one that's true"

 

Does that mean detect that there is a true in the array?  Or you want to know the location of the true in the array? Are you searching a 1d array?


The sentence "find the only one that is true" implies that there is exactly one that is true, so finding it implies getting its index. We already know the value and that it xists exactly once.

 

The only complication would be in the case of higher dimensions, but he only gave a single number of elements, so it is probably 1D.

0 件の賞賛
メッセージ8/25
10,543件の閲覧回数

@dan_u wrote:

Search 1D Array works fine with boolean arrays.


I want to find when it's true (1) so I tried to put 1 into the element node, but it asks for some sort of array. So I'm just confused about this.

0 件の賞賛
メッセージ9/25
10,539件の閲覧回数

@altenbach wrote:

So far we assumed that you have a 1D array (you did not say!)

 

(In the more general case, this idea would help too, but it does not seem to get a lot of love. 😉 Only 16 kudos 😞 )


I'm sorry it's a 2D array.

0 件の賞賛
メッセージ10/25
10,509件の閲覧回数