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

Get elements from array

解決済み
解決策を見る

Good evening.

 

I am a Labview beginner. Before joining the community group I searched but I couldn't understand much. I'll explain my problem: I have a 1D array string and I would like to extract all the strings from this array, one at a time (like a bingo abacus) and gradually reduce the size of this array. is it achievable? 

 

Is it possible to save the remaining elements in a document?

 

Thank you all,


Cheers


P.S. : i am apologies for my english

 

 

0 件の賞賛
メッセージ1/9
3,501件の閲覧回数
解決策
受理者 Oivlis

Try this:

 

Cycle array.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 件の賞賛
メッセージ2/9
3,490件の閲覧回数

Thank you, it works perfectly.

 

Assuming I want to extract values ​​at random, the only solution is to use the shuffle funtion before my array?

 

I have tried and it works.

 

 

0 件の賞賛
メッセージ3/9
3,440件の閲覧回数

Hi Oivlis,

 


@Oivlis wrote:

Assuming I want to extract values ​​at random, the only solution is to use the shuffle funtion before my array?


You might use the RandomNumber function (and IndexArray) instead of shuffling the whole array…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
メッセージ4/9
3,431件の閲覧回数

@GerdW wrote:

Hi Oivlis,

 


@Oivlis wrote:

Assuming I want to extract values ​​at random, the only solution is to use the shuffle funtion before my array?


You might use the RandomNumber function (and IndexArray) instead of shuffling the whole array…


Except that with each random removal, the random range needs to be reduced.

 

You did not really explain the problem in detail. Are you more interested in the extracted elements (one at a time) or in the ever shrinking remaining array that ultimately has zero length, i.e. is no longer interesting at all!?

 

Constantly resizing arrays can be expensive and clumsy. Can you take a step back and tell us what you really want to do with all this? My guess is that you are overcomplicating things. Start with explaining the term "bingo abacus". What is it? Do you have a link?

 

0 件の賞賛
メッセージ5/9
3,385件の閲覧回数

Hi,

 

first of all I would like to thank everyone.

 

The project became this:

 

I have a constant array of strings, where strings are the names of waiter .

A waiter name is extracted at each iteration of the for loop and this name is removed from the list. The array is reshuffled and the extraction continues.

 

I added background music to create suspense.

 

 

 

 

0 件の賞賛
メッセージ6/9
3,339件の閲覧回数

@Oivlis wrote:

 

The project became this:

 

I have a constant array of strings, where strings are the names of waiter .

A waiter name is extracted at each iteration of the for loop and this name is removed from the list. The array is reshuffled and the extraction continues.

 


Sounds like homework assignment...

How/when does the waiter get re-inserted?
What happens if there are not enough waiters?

What happens if there are too many waiters? (IE. some one might never get picked due to shuffling each time. Someone might get picked too often...)

So many questions...

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 件の賞賛
メッセージ7/9
3,314件の閲覧回数

@Oivlis wrote:

Assuming I want to extract values ​​at random, the only solution is to use the shuffle funtion before my array?


With your latest information, this shuffling is a good solution. If you leave the Delete from array 'clean', without any numbers connected you'll get the last element as the deleted part and keep the rest.

So, Shuffle array, Extract last element as winner, and repeat with the now 1 shorter array.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 件の賞賛
メッセージ8/9
3,285件の閲覧回数

Hi,

sorry if I answer only now.

 

it's a homework but it wasn't assigned to me. I have recently become a systems teacher and I have to learn this software that I have never used. I'm doing it with homework that I find on the web (also the core manul1)

the questions you me give me many ideas to reflect.

I thank you.

0 件の賞賛
メッセージ9/9
3,249件の閲覧回数