LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to realign elements of an array? Working with old Dynamic Data consumers

Hello,

 

I've got some code which was written with DAQ assistants years ago.  I'm trying to use tasks and arrays for my producer now for speed and efficiency, but I'm stumped on one thing.

The consumers were written to have the data in a certain order - there's even a VI in there that selects certain elements and sends them to specific outputs.  I previously took care of this with a simple VI that split the dynamic data, wired them to different order terminals, and then set it back to dynamic;  Screenshot attached.

 

Is there a structure like this for array where you can break out all the array elements, reorder them and insert constants, and then put them back into the array?  What this ends up feeding is a subvi that's an array builder which converts the DD to array and then reroutes it.  Seems almost like what I'm trying to do could be done there, but it's a bit confusing to me.

 

Thanks in advance.

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 1 of 7
(3,498 Views)

I think I got this.  Premature post.  If someone could look and compare, that would be great.

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 2 of 7
(3,478 Views)
Given the only difference is that you are inserting 0s in a few places, it would be more efficient to use the built-in insert into array functions.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 7
(3,456 Views)

I never looked at that function.  I guess I overcomplicated it (or oversimplified it), but I'll give that a look.  Anything to clean up this code and make it more efficient.

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 4 of 7
(3,434 Views)

Hi Ralph@NES,

 

One thing I have done before for this is create a mapping array and a for loop to reorder the elements in your data array. Take a look at the example VI I've attached. If you know exactly where you want everything, you just need to go into the mapping array and set the index destination for the corresponding data. Hope this helps.

 

Paul C

Paul C
0 Kudos
Message 5 of 7
(3,385 Views)

Paul,

 

I'd love to give that a look.  Any chance you can save it for 13?  I haven't done my 14 upgrade yet.  Thanks in advance...

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 6 of 7
(3,368 Views)

Sure thing, here is the file saved for LabVIEW 2013. Let me know if this helps!

Paul C
0 Kudos
Message 7 of 7
(3,352 Views)