LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

access and modify one array element

HI! I'm new to LabView. Not really into the shift register thing up to now that might be my problem. An Array should present how often a die fell on a specific number in the element which represents the number by the index. Simple Example but crucial. Maybe someone could tell me what is wrong and give me an idea how the registers work.
Thanks
0 Kudos
Message 1 of 6
(2,934 Views)
Since you want to operate on an array with 6 elements, you need to initialize an array with that size before feeding it to the shift register.
---> Change size in "initialize array" to 6.
Also, note that "Round to nearest" will not give you an equal distribution. because the first slot gets only 0-0.5, while the second slot gets twice as many on the average (0.5-1.5), and so on. You should replace it with "round to -infinity" so all probablilties are equal (0-.999.., 1-1.999.., 2-2.999 ... 5-5.99...). (The chance of getting a "6" is infinitely small).
Message 2 of 6
(2,934 Views)
Thanks for your help. I treid really many different things yesterday, in the end I oversaw such a "small" thing... I thought about the probability as well, but it is just a training example, important for my Labview knowleges but not important for my work. One thing I thought of would be to multiply the random number with 6.9999999 and not 6 so still this wouldn't be 100% correct but better.
Thanks again for your help...was really essential.
0 Kudos
Message 3 of 6
(2,934 Views)
HI again!
I came to another quite similar problem and it showed me that I didn't understand the shift register Array combination completely. Simple VI attached should detect the all time max and min values of the temperature. I can initialise an Array but can not assign the temperature value to it even if i use build array on it. It says two sources. but the one source is only to initialize? I dind't get it to work evrytime I tried I got the actual value on both min and max presented. Hope you can help me again on this one!
0 Kudos
Message 4 of 6
(2,934 Views)
Well, there is no reason to put another loop inside the main loop. The shift registers go on the main while loop. You also need to only store the current max and min, not the entire array.

I have attached an example.
0 Kudos
Message 5 of 6
(2,934 Views)
Thanks..
Great help.
ANDY
0 Kudos
Message 6 of 6
(2,934 Views)