LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wires are better than local variables?

Solved!
Go to solution

Hi 

 

I have built a vi which has eventually become huge with lots of sequence and cases. Local variables sure reduces a lot of wires but at the same time consumes memory. So which ones better? wires running throughout the vi or local variables?

 

Regards

sarkar

0 Kudos
Message 1 of 20
(3,298 Views)

Thanks Ravens. I am just getting the hang of Labview

 

Regards 

sarkar

0 Kudos
Message 3 of 20
(3,294 Views)

@chips wrote:

I have built a vi which has eventually become huge with lots of sequence and cases. Local variables sure reduces a lot of wires but at the same time consumes memory. So which ones better? wires running throughout the vi or local variables?


Since local variables break dataflow, they often necessitate the use of sequence structures to enforce correct execution order. If you use wires, many of your sequences can probably be eliminated, greatly simplifying your code. Unless you are dealing with large data structures (such as big arrays), memory is typically not of concern. The problem with local variables are race conditions and unmaintainable, overly complicated code.

 

Also note that a single VI should NEVER become "huge" by any definition. Structure your code into subVIs and used a well established modular design pattern.

 

Feel free to show us your code, maybe we can give more specific feedback to get you started in the right direction. 🙂

Message 4 of 20
(3,290 Views)

Okay so if i have a if structure like if (x && y)

 num=1

else if (y && z)

 num =2

else 

 num=3

How do i change the value of numeric indicator (num)without using local variable?

0 Kudos
Message 5 of 20
(3,279 Views)

Is num an indicator?

 

Put the indicator outside the case structures and put the various constants inside the respective cases wired out of the case structure by way of tunnels.

0 Kudos
Message 6 of 20
(3,274 Views)

Its going to be a very very complex case structure. But then i will prefer complexity to possible race around condition

0 Kudos
Message 7 of 20
(3,271 Views)

Thanks for your time 🙂

0 Kudos
Message 8 of 20
(3,270 Views)

How to implement it depends on exactly what you are trying to do. But your biggest problem is that you are trying to write LV code while thinking in C. They are two different languages and require different approaches and different ways of expressing the solution to the same problem.

 

Where are the numbers coming from? is the user entering them? are they coming from a DAQ device?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 20
(3,246 Views)

Yes Mike i am new to LV and user is entering the data.

 

0 Kudos
Message 10 of 20
(3,226 Views)