LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Where does Labview save variables?

So I'm trying to read a text file line by line, and I've already seen some VI's that do this.  However, I want to go a step further and save some strings as local variables.  My background is in Matlab, where there's a 'workspace" where all local variables are saved and can be used/called later.  I was wondering a "workspace" of saved local variables exists within LabVIEW- and if not, how I would go about saving particular lines from my text file as some sort of variable that I can access later, or in a another sub-VI.

 

Thanks

0 Kudos
Message 1 of 16
(4,859 Views)
Hi,

LabVIEW doesn't use variables. It stores data in wires - THINK DATAFLOW!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(4,844 Views)

You can think of wires as variables.

 

You really need to get a handle on dataflow though, and let go of text-based languages.

 

If you plop an ADD function on your diagram, the function needs two input wires.  As soon as somebody "writes" a wire, whoever is waiting on that data can execute.

 

The ADD function waits until BOTH inputs have a new value, then it executes, and puts the result on the wire going out of it, where some other function might be waiting on it.

 

There are places where actual storage happens, but think of wires as variables and you will get over the beginner's hurdle.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 16
(4,838 Views)

The primary LabVIEW equivalent of "variables" are "wires".  Try to step back a bit from the paradigms you've learned in Matlab as you learn LabVIEW ones.  There are secondary features of LabVIEW that can be used more like the "dataspace" you're thinking of, but LabVIEW is inherently multithreaded, which works badly with such by-reference data access.

0 Kudos
Message 4 of 16
(4,837 Views)

In case it wasn't clear from the previous answers, the wires can be thought of as variables.  Smiley Very Happy

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 16
(4,817 Views)

Can we think of wires as variables?

 

Edit:

 

In seriousness, if you want to initialize variables, a common way is to use the configuration palette with a ".ini" file.

 

If you just want to know how to access variables later, then a global or action engine (functional global) might serve you well. You will find a lot of information if you type "labview action engine" into google, and you can start with a "storage" case which reads a text file and stores the data you want, as well as a "read" case which lets you access the data.

0 Kudos
Message 6 of 16
(4,791 Views)

Think data flow...wires...variables...am I too late to the party?  Need to check this more often on the weekend I guess.

0 Kudos
Message 7 of 16
(4,720 Views)

I think it depends on what you are trying to achieve. If you have a specific project, some details would enable us to give you the correct method.

 

LabVIEW does have global variables that you can use, it is covered in Core 2 training. But as to whether you would use that, would completely depend on what the specific task was. Global variablies are not used that frequently because there is better ways of doing many things in LabVIEW.

 

You could think of a wire as a variable but the only way to access that data is to link the wire to something. Its not saved somewhere that you can recall in another section of code unless they are linked by wires or you use global variables.

0 Kudos
Message 8 of 16
(4,702 Views)

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. Here's a simple resource to become more familiar with how it works. The Highlight Execution feature is a great way to watch how your application utilizes dataflow through the wires (vars).

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 9 of 16
(4,684 Views)

Thanks for the answers so far, I understand now that saving the variables may not be the best way to think about solving this problem .  Here's some more details as to what the exact problem is.  I have a text file formated like this:

 

x,y, length, hieght

5,5,10,6

names of files

kappa.exe

smorc.txt

 

Theres a line with a description, and some numbers or strings that follow.  What I want to manipulate are the "variables" like 5,5,10,6 or kappa.exe and smorc.txt.  The parts of the text file that should remain unchanged are the descriptions like "names of files" and x,y,length,height.  At the end of the day, the GUI will have some boxes where a user can change these "variables" to their liking (like changing some but not others) and save a new text file.  So far, I've made a VI th/at concatenates strings into the format u see above; I created numeric and string controls where applicable so that the user can create a new txt file in this format.  However, what if there already exists a text file with some variables?  

 

This is where I am struggling.  I also want the VI to read the text file and display what variables are already in place in those numeric and string control boxes.  Then the user should be able to manipulate the variables in those boxes and save a new text file.  So this is where I started thinking that reading and then saving a line as a workspace variable, since this would be one way of doing it in matlab.  I'm trying to recreate this process in LabVIEW, but it looks like itll have to be done another way. 

 

any ideas or help would be greatly appreciated!

0 Kudos
Message 10 of 16
(4,634 Views)