LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using arrays

Solved!
Go to solution

Hi!

I am trying to store my data in an array. I can get an input 3-18, and then I want to store, how many times I got the indvidual numbers. Like 3-3s, 2-4s, etc. So my idea is to make an array full of 0-s, and then add one to the element, which index is the input minus 3. But I cant convert my numeric input to long(The type of the source is 1D array of
long

[32-bit integer (-2147483648 to 2147483647)].
The type of the sink is long [32-bit integer (-2147483648 to 2147483647)].),

and I would need an array, which has in- and output. Could someone please help me out?

0 Kudos
Message 1 of 5
(1,143 Views)

Start with a few simple tutorials. (There is no toplevel loop, the case structure and boolean serve no purpose, there is a "+1" primitive which you could avoid by rounding towards +inf instead. etc.)

 

Your question is not clear. All you probably need is one loop to do everything. The index input to "replace array subset" is a scalar, so you need to process it one element at a time, for example in a FOR loop.)

 

Also please attach your actual VI. It is impossible to run and debug pictures.

0 Kudos
Message 2 of 5
(1,119 Views)
Solution
Accepted by topic author Maklaba

Here's one possible solution. (Note that I also just attach an image instead of a VI to give you something to do ;))

 

 

altenbach_0-1614190427157.png

 

 

0 Kudos
Message 3 of 5
(1,107 Views)

Thank you so much! I need to round downvards, because I dont want to have a 0 output, which happens, if the random number generator gives me 0. But thanks for the other stuff!

0 Kudos
Message 4 of 5
(1,102 Views)

The help is wrong. The random number cannot be zero.

 

 

EDIT: This page is correct and uses the same wording as the original paper by Wichmann&Hill.

 

"... rectangularly (evenly) distributed between 0 and 1, excluding the end points ..."

 

So yes, zero or one cannot occur!

0 Kudos
Message 5 of 5
(1,098 Views)