LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

moving elements from array to array

I tried replacing the buttons with DAQ assistant ( and configured my DAQ device with 5 buttons) but when I wire the Data output of the DAQ assistant to the cluster to array function, I get errors.

0 Kudos
Message 21 of 84
(1,001 Views)

nevermind, I figured that part out, 

Sorry

0 Kudos
Message 22 of 84
(1,000 Views)

Since you mentioned that there will be several more queues, each with different sizes and expiration, the next step would be to make it scalable. I suggest a reentrant subvi that internally maintains the timing and size enforcement, with in-/outputs for array 1&2, inputs for size, and ttl, and an output for array 2. You could even make it type agnostic by turning it into a vim.

0 Kudos
Message 23 of 84
(983 Views)

I tried to add to this VI ( i attached my modified code). I added to my code so that the elements go from queue 3 to queue 4 and then queue 4 can only hold 4 elements. And till this point it worked fine, but then i tried to add code to keep the elements in queue 4 for a specific amount of time then move to queue 5, but then when i tried to run it, the elements were not moving to the 5th queue after the time has passed.

0 Kudos
Message 24 of 84
(975 Views)

Never ever attach a modified (by you!) VI that has the same name as what I attached earlier! you need to give a new unique name to avoid confusion!

 

Obviously, each array with limited size/ttl needs it's own shift register for timing. You cannot put it all in one pot! Right?

0 Kudos
Message 25 of 84
(968 Views)

sorry about that,

 

I did add a shift register for the 4th array, and before I added the code to keep the elements for a specific amount of time then move them to the 5th queue, everything seemed to work fine (id only get 4 elements in the 4th queue and if there's more they wait in the 3rd queue), so I don't understand what's wrong with my code now.

0 Kudos
Message 26 of 84
(966 Views)

Well, if you made corrections and everything works fine why do you say something is wrong??? Sounds contradictory!

 

Please attach your latest version (with a unique file name!). I would be happy to look it over. Explain exactly how you use it, what you expect to see, and what you see instead.

0 Kudos
Message 27 of 84
(963 Views)

Ok so what i need it to do is after it goes to queue 3 the elements move directly to queue 4, But queue 4 can only take a max of 4 elements at once, and each element should stay in queue 4 for a random time then move to queue 5. 

I tried to code this, and the elements do move to queue 4 and it only takes a max of 4 elements, but after the time runs out, instead of moving to queue 5, the elements stay in queue 4 and the values in the cluster change to 0. So what did i do wrong, that prevents the elements from going from queue 4 to queue 5.

0 Kudos
Message 28 of 84
(943 Views)

As I said, each time limited array needs its own orange array in its own shift register.

 

It is a glaring error to only have one array of ticks snaking through all the various case structures. I don't think you fully understand my code yet.

0 Kudos
Message 29 of 84
(939 Views)

I tried adding a shift register and an initialize array for queue 4, and now it does take only a max of 4 elements and the elements dont go to zero, once the timer finishes, but the elements still dont go to queue 5, So can i just get help with why arent the elements moving to the 5th queue

0 Kudos
Message 30 of 84
(923 Views)