LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble distributing numbers to three 2D arrays? Help is needed. See attached code.

My goal is to distribute number to three separate arrays.

I want to insert numbers using control 1 into the 2D arrays while the code is running. The goal is to insert these numbers randomly. So all the numbers less or equal to -1 will be going to 2D array (on the left), all the 0 go to the middle 2D array, and all the numbers greater or equal to 1 will be go to the 2D array on the right. 

I tried, but I am stuck. I was wondering if someone could help with this.

I'm expecting the array sizes to keep increasing as I am entering the numbers. 

I would prefer this to be done without using an event structure or state machine if possible, just one single loop if possible. No consumer producer loop. Can someone please help?

0 Kudos
Message 1 of 2
(106 Views)

Hi GRCK,

 


@GRCK5000 wrote:

The goal is to insert these numbers randomly. So all the numbers less or equal to -1 will be going to 2D array (on the left), all the 0 go to the middle 2D array, and all the numbers greater or equal to 1 will be go to the 2D array on the right. 


What exactly is "randomly" when you know exact conditions where to put those data?

 

Why is there only one shift register when you want to handle 3 arrays?

Why don't you check the value of the "Control1" for its sign?

Why do you need to determine array sizes so often?

Why do you need 2D arrays to store scalar data?

 

All you need is one case structure and the sign function to check your "control1" input…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 2
(91 Views)