取消
显示结果 
搜索替代 
您的意思是: 

How to (most efficiently) pass data around

已解决!
转到解答

@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.



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 项奖励
11 条消息(共 29 条)
1,454 次查看

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 项奖励
12 条消息(共 29 条)
1,449 次查看

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 项奖励
13 条消息(共 29 条)
1,427 次查看

@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.



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 项奖励
14 条消息(共 29 条)
1,423 次查看

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 项奖励
15 条消息(共 29 条)
1,417 次查看

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



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 项奖励
16 条消息(共 29 条)
1,412 次查看

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

0 项奖励
17 条消息(共 29 条)
1,382 次查看

Hey Chris,

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

0 项奖励
18 条消息(共 29 条)
1,371 次查看

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

-Jim B
Applications Engineer, National Instruments
CLD, CTD
0 项奖励
19 条消息(共 29 条)
1,361 次查看

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 项奖励
20 条消息(共 29 条)
1,352 次查看