LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get elements from array

Solved!
Go to solution

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 Kudos
Message 1 of 9
(2,327 Views)
Solution
Accepted by 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 Kudos
Message 2 of 9
(2,316 Views)

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 Kudos
Message 3 of 9
(2,266 Views)

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
Message 4 of 9
(2,257 Views)

@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 Kudos
Message 5 of 9
(2,211 Views)

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 Kudos
Message 6 of 9
(2,165 Views)

@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 Kudos
Message 7 of 9
(2,140 Views)

@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 Kudos
Message 8 of 9
(2,111 Views)

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 Kudos
Message 9 of 9
(2,075 Views)