LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I have shortcuts in VI's to connect wires

I want to reduce the cluster of wires in my vi. How can I have a terminal at one end which wirelessly connects to another similar terminal and I can then draw out a wire from the second terminal and do whatever I want to. Like a wormhole from one part of the VI to some other part of the VI.

0 Kudos
Message 1 of 17
(3,491 Views)

You may want to look into Queues or possibly a Functional Global. Locals will also "solve" this problem, but can quickly reinforce bad coding habits and introduce readability problems.

 

However, if you find that your block diagram is becoming a huge mess of wires, the first thing you want to ensure is make sure you're implementing a solid architecture. Is your code organized using a state machine or similar?

 

 

0 Kudos
Message 3 of 17
(3,467 Views)

@Soham wrote:

Like a wormhole from one part of the VI to some other part of the VI.



You mean like this?

 

How are you planning to enforce data dependency and execution order?

 


@Soham wrote:

I want to reduce the cluster of wires in my vi.



Seriously, You already mentioned the keyword "cluster", so bundling data that typically stays together into a cluster will significantly reduce the wire clutter.

0 Kudos
Message 4 of 17
(3,463 Views)

Basically I am making a MUX as can be seen in the attached figure. So rather than having a local variable of string 5, can I have a different variable of that sort in which wires go in and come out of the other end. Something like the altenbach showed. And how did altenbach do it, please help me.

 

Thanks.

0 Kudos
Message 5 of 17
(3,425 Views)

There are lots of ways to do this.  One simple way is to chain the case structures together.  You can leave your existing case structures, but instead of having a local variable of String5 in each one, instead wire that string through the true case into the next case structure.  In each following case structure, pass through the string you want in the true case, and in the false case pass through the string that came from the previous case structure.  At the last case structure, wire the string output to the String5 indicator.

0 Kudos
Message 6 of 17
(3,410 Views)

Please attach your VI instead of a picture.

 

Obviously you have exactly four possible outcomes, because if two of the current cases would be true, the result would be random due to race conditions

 

All you need is a single case structure with multiple cases and all string controls wired into it. Do some logic (e.g. see below with the two booleans to select one of the four cases). The string indicator is after the case structure, no local variables needed.

 

Another option would be to build the four string controls into an array. Also build the two booleans into an array, convert the boolean array to a number and use it to index into the array of string inputs to obtain the string output.

 

Obviously you have exactly four possible outcomes, because if two of the current cases would be true, the result would be random due to race conditions

0 Kudos
Message 7 of 17
(3,404 Views)

Here's what I have in mind. Simple enough?

 

 

(If you want seperate controls, simply use build array to merge it into my example code. No local variables or underground wires needed. Right? Attached VI is LabVIEW 8.2)

 

 

Download All
0 Kudos
Message 8 of 17
(3,399 Views)

What is the thing that you have done after the boolean array? Sorry if its something simple...im sort of a newbie. 🙂

0 Kudos
Message 9 of 17
(3,392 Views)

As a student then you should learn to use the manual. The code posted is a snippet, which you can drag and drop onto a block diagram. Then turn on the Context Help.

 

Then do this: To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. There are also several Technical Resources. You can also take the online courses for free.

0 Kudos
Message 10 of 17
(3,372 Views)