From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Class

Solved!
Go to solution

Hello,

I have defined a class with a single variable, and two methods for set and get the value of the variable, the variable is declared as private in the class, and both the methods are declared as public. can some one please help me to find the mistake, of set method or get method, they are not working as expected, i.e. display the value of the varible, after i excute the set method.

Thanking you in advance

Venkatesh

0 Kudos
Message 1 of 6
(2,550 Views)

Hope the illustration is sufficient:

17907iA7B8BB44321FB027

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 6
(2,541 Views)

If you branch the wire for a class (like you do before your first case structure) then you are creating a copy of the object, not a copy of a reference to the object.

 

This means that any changes you are making to your copied object in the write case are never going to be communicated to the read case because thes are operating on two completely different objects.

 

I have re-written the test VI for you to fix the problem.

 

Shane.

0 Kudos
Message 3 of 6
(2,540 Views)

Thank you for the replay, can you please send the corrected vi for Labview ver 8.5

 

 

0 Kudos
Message 4 of 6
(2,531 Views)
Solution
Accepted by topic author venkatesh@je-depa.com

Actually, I don't think so because IIRC the "save for previous" from LV 2009 is broken and I don't have any intermediate version to help me out in this regard.  Maybe someone else can help you out.

 

My changes were trivial.  You just wire through the original object wire instead of branching the wire as already displayed above and wire the object to a shift register instead of a tunnel when entering the loop.

 

Shane.

0 Kudos
Message 5 of 6
(2,528 Views)

Thank you, the shift register is working. Does the branching instantiate copy of the same class as 2nd object? if so how can i create refence of the 2nd object.

0 Kudos
Message 6 of 6
(2,517 Views)