LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

build array

I am using this VI together with Vision Builder. What happen is that VBAI will update the "Y_position", "Lines_cnt" constantly with numbers.

My purpose is to save all the"Y_position" values in an array "Array".

However the snippet doesn't quite work as expected. For example, if the VBAI updates "Y_position" in this manner: 10.0, 10.5. 11.4, 16.1, the "Array" will only show "0, 0, 0, 16.1". How come the first 3 elements of the array are all 0?

Please help

0 Kudos
Message 1 of 11
(2,942 Views)

sorry the snippet should look like attached..

0 Kudos
Message 2 of 11
(2,935 Views)

It might be helpful to include a simple inspecion that illustrates this problem. I don't see anything wrong with the code you provided. Maybe if you show how and when you update the Lines cnt and Y position it will be more clear why you're not getting what you expect.

 

Thanks,

Brad

Message 3 of 11
(2,932 Views)

Hi Brad,

 

I have to disagree: there is something wrong with the code!

 

@splee:

- Why don't you use a wire for the "lines cnt"? Right now it looks like a big race condition...

- "Wrong" (IMHO) is not to use the cleanup tool. Your wires go the wrong way and are (partially) hidden - it's bad style that easily leads to bad programming...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 11
(2,916 Views)

Are you using this VI in a Run LabVIEW step? If so, why isn't your lines cnt a control instead of an indicator. Make sure you have this control being updated with a previous measurement in the Run LabVIEW VI step. You should use the Vision forum next time instead of the LabVIEW one to avoid confusion with general LV programming.

 

Thanks,

Brad

Message 5 of 11
(2,912 Views)

Hi GerdW,

I don't quite understand about the race condition.

I did use a wire for "lines_cnt". Basically it is a numeric display, and the update comes from Vision Builder.

I don't know how to use the cleanup tool. Could you please show me how I can find out more about it?

And also I believe there is no hidden wires..

I'll post again later

0 Kudos
Message 6 of 11
(2,881 Views)

Dear Brad,

Nope I am not using this in a "Run LabVIEW step". "Lines_cnt" is an indicator as it is updated by Vision Builder.

 

0 Kudos
Message 7 of 11
(2,880 Views)

I cut and pasted the block diagrams, and modified it by changing the update-by-VBAI from user-manual-update, as attached.

This one works though...

But it just does not work in my original program.

0 Kudos
Message 8 of 11
(2,879 Views)

Hi splee,

 

the "cleanup" tool is the rightmost icon in the tool menu of the blockdiagram...

One more: instead of placing an array constant initialized with 2001 elements you could also place the InitArray function. It is more easy to read and the compiler will also replace it (internally) with a constant...

 

@Brad:

As you're working at NI: Could you please file a CAR to change the context help for the feedback node (and post the CAR number here)?

I cannot find any information about the "activation input" (well, my German LV names it "Aktivierungsanschluß"). Either the help doesn't explain it or I'm not able to find that information. In case I'm wrong: could you show that piece of information in the context/online help? And: could you explain the purpose of that input?

 

@splee:

What happens when you delete the TRUE constant?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 11
(2,866 Views)

Hi GerdW,

Removing the TRUE constant does not work either

0 Kudos
Message 10 of 11
(2,862 Views)