Jump to content

Insert Into Array


Recommended Posts

I have found a strange behavior of Insert Into Array in LV 8.0 I have used it many times in LV 7.1. If I use Insert Into Array in a loop (While loop) then I will get an array which is going bigger. As input of n-dim array I use the output of initialize array which is the same all the time and I insert a fix element into the first place.

See the attachment.

Jan

Hi,

If you chance the value of the element from the initialize array it starts from the begining.

Change the Indicator "initialized array" into a control instead of the initialize array the VI will work fine.

very strange.

Uli

Link to comment
  • 3 months later...

I had the same problem.

Here's a portion of NI support's response:

_____

This appears to be a constant folding bug. I apologize if this is review,

but constant folding is the process by which the compiler takes the code

and wraps the constants into the compiled machine code itself rather than

allocating storage in memory for them like variables. LabVIEW appears to be

tricked into thinking that it doesn't need to recheck the color control

array input again, since all the inputs it receives in the loop are

constants.

We have seen similar issues on rare occasions with loops and constants in

LabVIEW 8.0, though not this particular instance. I am quite confident you

would see the same behavior with a For Loop in your code. I will add your

information to those existing reports for further investigation by R&D.

This will be a high priority for us to say the least.

In the meantime, I would recommend one of the following workarounds. First,

as you mentioned, you could place the Index control inside the loop, which

will short circuit the constant folding that causes this bug.

Alternatively, you could leave the Index control outside the loop and turn

its wire tunnel on the loop frame into a shift register. Then just wire the

data through from the left shift register node to the right one. That will

force LabVIEW to reread the control value every time.

____________

-James

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.