LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create an array

Hello

I am no scripting ninja, more like a scripting virgin, but I do enjoy to script .

On my recent my project I came up with a few questions, so in an effort to program better and learn a few tricks along the way I have a few questions that I hoping some ninjas (or anyone that knows!) can help me with.

My first question is:

How can I create a new array object and insert a datatype programmatically?

E.g. I can create an array shell but how to I assign the array as string or I32)?

My workaround was to use a control (ctl) file. It worked but can I do through a node instead?

Example attached.

create new object.png

My second question is:

Can I move a control from inside a structure to the panel (BD)?

I wanted to move a control outside of a case structure frame. I tried the move method by assigning the owner as the BD panel but no luck. I end up deleting the control inside the case structure then creating a new one. Is there a better way?

Thanks


JG

0 Kudos
Message 1 of 3
(3,272 Views)

An array is a container, not a final datatype.  To create an array of I32s, for example, create the array, create an I32, then move the I32 into the array.  Arrays are a somewhat weird container in that they do not have a diagram.  Just use the array itself as the owner when you do the move.

I believe your second problem is due to using the control and not its terminal when you tried to move it.  Controls reside on the front panel.  Control terminals reside on the block diagram.  You can get from one to the other using the appropriate property of each.

0 Kudos
Message 2 of 3
(2,633 Views)

DFGray you are a true ninja!!

Thanks heaps I got it to work straight away.

I attached the example code if anyone else is interested.

Cheers

JG

Download All
0 Kudos
Message 3 of 3
(2,634 Views)