LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Local Variable Does NOT get Updated?

Solved!
Go to solution

Hi altenbach,

 

Please see the attached code.

0 Kudos
Message 11 of 27
(1,293 Views)

Hi Altenbach,

 

Please see the attached code. No more gibberish, just the code 🙂

 

While we're at it, I also occasionally get the Invalid Property Value whenever I run the code by opening up a few files, then on subsequent run open up several files.

0 Kudos
Message 12 of 27
(1,288 Views)

To be perfectly blunt your code really should be re-written. You should consider using more subVIs, less local variables, and get rid of all of the sequence structures. The best way to describe this code is that you are trying to turn a data flow language into a traditional text based sequential language. Trust me, you can write large complicated applications without using any global variables, local variables (with the exception of some UI code) or sequence structures. Learn how to use data flow effectively. This code if it lives for any length of time will be difficult to maintain and enhance. One of the stables of LabVIEW is a state machine. Your code looks like it could easily be turned into a state machine. Then you could get rid of all those local variables by using shift registers.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 13 of 27
(1,282 Views)

Thansk Mark. I am actually trying to make the code simpler and modular precisely for the reasons you mentioned, like code maintenance.

As a matter of fact, I am making chucks of my code into sub VIs, but as of now I am not familiar with state machines. So I have to learn and then apply.

For now, I already got rid of the sequence and local variables, but I still see the same problem. Once I simply the code, I'll see if it goes away.

0 Kudos
Message 14 of 27
(1,277 Views)

murchak wrote:

While we're at it, I also occasionally get the Invalid Property Value whenever I run the code by opening up a few files, then on subsequent run open up several files.


Well, you don't seem to wire most error output, so we don't really know where they occur. My best guess is that you are writing propertis for more plots than you currently have. Make sure to draw the data first, before changing plot properties. For example if the old dataset had 5 plots, and the next one has seven, writing properties for the last two will fail if you do that first.

Message 15 of 27
(1,270 Views)

I think cross usually posts these links, but look here:

LabVIEW Introduction Course - Three Hours

LabVIEW Introduction Course - Six Hours

 

🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 16 of 27
(1,254 Views)

Ah floating indicators over a HUGE tab control in an area normally off screen.  Have I ever mentioned I hate that tab container!  Buggy buggers, especially with huge panels! You almost Have to defer FP updates to get all that junk into and out of the UI thread. Use wires rather than locals.Smiley Wink


"Should be" isn't "Is" -Jay
Message 17 of 27
(1,246 Views)

Hi Altenbach,

 

Before I could fix my code, I wrote a very simple code that plots data from a number of files (file1 to file 10). The user can choose any number of files.

The code is supposed to plot Y vs. X and plot error bars as well such that the color and point style match the main curves.

 

The code works fine, but when I make it a subVI and call it from another code, it doesn't update the line colors, point style, etc.


How could this happen?

 

 

0 Kudos
Message 18 of 27
(1,233 Views)

You are updating the properties of the graph that is within the subVI.  You are not updating the properties of the graph of the main VI.

 

What you need to do is pass the reference of the graph in the main VI to the subVI.  The subVI will need a control on the connected to the connector pane that is a graph reference so that it accepts the reference passed in from the main VI.

Message 19 of 27
(1,228 Views)

Thank you RavensFan! Minutes after I posted that, I saw what I was doing wrong.

I am fixing this now. Thank you for your help. I will continue to keep this link open because the original issue has not been solved.

0 Kudos
Message 20 of 27
(1,224 Views)