LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to (most efficiently) pass data around

Solved!
Go to solution

@tonyyyyy wrote:

Does labview has a concept of pointer as in C++?

So i can just use address instead of copy of the whole variables in different VIs or different loops.


The Data Value Reference (DVR) is as close to a pointer as you will ever see in LabVIEW.  As I said before, the DVR is a reference to your data.  You have to use the In Place Element Structure to access the data.  This is done to protect critical paths.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 11 of 29
(1,259 Views)

In order to use the DVR "wirelessly", one suggestion is to make a Functional Global Variable (FGV). This is a non-re-entrant VI containing a shift register on a single-iteration loop. Write your DVR to it once (to load the shift register), then use that FGV anywhere in your code and read your DVR from it. Another option is to use a Single-Element Queue (SEQ).

 

0 Kudos
Message 12 of 29
(1,254 Views)

Quick questions:

1. In case of this problem as attached, how to pass it using DVR?

2. how does it (performance) compared to global variables?

 

 

Untitled.png

0 Kudos
Message 13 of 29
(1,232 Views)

@tonyyyyy wrote:

Quick questions:

1. In case of this problem as attached, how to pass it using DVR?

2. how does it (performance) compared to global variables?


For that example, I would just use a queue.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 14 of 29
(1,228 Views)

hi Cross,

Definitely, you can.

But, what about if I want to use DVR? 

How to wire accross 2 loops?

Any way? or , DVR simply doesnt work in this scenario.

0 Kudos
Message 15 of 29
(1,222 Views)

Like a Queue, you would have to create the reference before the two loops and pass the reference into the loops.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 16 of 29
(1,217 Views)

Here is a very simple code outline of how to pass a queue reference between two loops.

0 Kudos
Message 17 of 29
(1,187 Views)

Hey Chris,

Is there a way not to use wire? (wireless ) 😄

0 Kudos
Message 18 of 29
(1,176 Views)

Queues and DVRs really are wireless.  Both references are pointing to the same data.

-Jim B
Applications Engineer, National Instruments
CLD, CTD
0 Kudos
Message 19 of 29
(1,166 Views)

Thanks Chris & James,

But, any loops that uses that queue has to wire to the queue creator shown in the blue line.

 

Untitled.png

0 Kudos
Message 20 of 29
(1,157 Views)