06-28-2016 09:33 AM
I originally thought this was a simple issue I was having, but I've spent quite a bit of time trying to fix it and I'm out of ideas.
The goal is to be able to save across different tabs for a VI that controls an instrument, with each tab being a different mode of measurement. So, first I created a VI such that I was able to press a start/stop button and save a separate file for each press. I was able to do this without a problem. Then I tried to add this VI's functionality to a tab structure. The goal being that I could press a start/stop button and save a separate file for each press on any of the tabs (and over the course of the run use every tab). However, regardless of what I've tried I can't seem to be able to save on more than one tab at a time. The first tab of the run is functional, but then any subsequent tab is not. I've tried chaning the loop structure and how I write the files, but nothing has worked. I've attached a VI that displays the problem without the [extreme] amount of extraneous information the original has.
Any ideas? Thanks in advance.
Solved! Go to Solution.
06-28-2016
09:41 AM
- last edited on
12-11-2024
09:31 AM
by
Content Cleaner
You can't expect to run through different tabs during one run without a loop around the code. LabVIEW programming is based entirely on dataflow and parallelism. This is incredibly powerful and has lead to its success over the years (coupled with the graphical programming), but is usually one of the first things that new developers stumble over. The Highlight Execution feature is a great way to watch how your application utilizes dataflow.
You need to move your boolean control inside the event structure to register the value correctly and your code is going to lock up since you have multiple event structures separated within the tab cases.
You're not going to like hearing this, but the tab control is incredibly dangerous because you can very easily lock up your code. This mean, ideally, you only use the tab control for appearances or for sub-sections of your code that you want to operate differently depending on which tab is selected.
One of the first applications I made, which I was soooo proud of, had a tab control as the main container for the code inside. This worked great for a while, but I found I was duplicating a lot of code and then sometimes it would lock up, so I would have to throw some code together to put out one fire after the other.
Notice how your tab cases all look the same with minor differences based on the boolean and/or measurement type? This means if you make a change to one tab case, you will probably end up wanting to make that same change to all the other tabs, and now your workload is tripled for one change.
Look in to the Simple State Machine template that ships with LabVIEW. It is really the best way for new developers to get familiar with LabVIEW while utilizing a semi-scalable architecture.
Here's a broad example of how a state machine works:
You can have a different state depending on the measurement types you use and that state selection can still be governed by the tab control.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
06-28-2016 10:10 AM
Your code is completely inside-out.
06-28-2016 10:39 AM
Here is a simple draft that should get you started. (Not tested)
06-28-2016 11:10 AM
Thank you! I didn't think of this approach, or even know it was an option.