Discussion:
determine unused variables in labview
(too old to reply)
Ben
2006-06-20 13:10:08 UTC
Permalink
Maybe, but first, what are "variables"?
Ben
Guzz
2006-06-20 13:10:11 UTC
Permalink
i'm refering to all variables i've defined in my labview 8.0.1 realtime project
i want to be able to select a variable from the project view and determine if it is used in either my remote or local host VIs
 
EmmaR
2006-06-22 15:40:12 UTC
Permalink
Hi Guzz,
I think you are referring to ?Shared Variables?, which you are using to share data among VIs in a project or across a network.
There are various means of searching whether variables are being used in your project VIs. However, this cannot currently be done from the project view and certain methods can only be used to search whether locally stored variables are being used as do not work for remotely stored variables.
There are two ways of searching locally stored variables using the find and replace utility:
This method relies on having the variable labels set as visible items:
You need to create a blank VI within the library/project you're searching from and drag the variable that you wish to search for into the blank VI. Then click ?Edit? on the Blank VI toolbar and select ?Find and Replace? from the drop down menu. A ?Find? Window will open. Within the window make the following configurations: for the ?search for? option select ?text?, in the ?Type in words to search for:? selection box enter the name of the variable that you wish to search for, and for ?Search Scope? select ?<All VIs in Application Instance?. Click ?Find?.
All the locations where the variable is being used will be listed. If no locations listed then either the variable is not being used or the label for the variable is not a visible item.
This second method does not rely on the variables labels being visible:
EmmaR
2006-06-22 15:40:13 UTC
Permalink
Open the ?find? window as in the previous method. Within the window make the following configurations: for the ?search for? option select ?object?, ?globals? and click on the icon of the variable you wish to search for. As explained previously the location of all variables being used will be listed.
The attached example VI, "Cluster test.vi",  has been developed by one of our engineers as a starting point for anyone who wants to develop LabVIEW code which can search for and list the VIs where shared variables are being used.

Using the attached VI, "Cluster test.vi", you can also just have an array of the variables you want to search for, rather than having to strip them from the project names as long as the names of the variables are known.

 

I have zipped up an example LV 8.0 project so that the functionality of using "Cluster test.vi" can be easily seen.

Simply run the "Cluster test.vi" and it's front panel will populate the table control listing what variables are being used and in what VIs they are being used.

 

I hope this is helpful.

 

Emma Rogulska

NIUK & Ireland

 


SharedVariableSearchVI.zip:
http://forums.ni.com/attachments/ni/170/191496/1/SharedVariableSearchVI.zip
EmmaR
2006-06-23 08:40:08 UTC
Permalink
Hi Sima,
My apologies.
You are completely right I attached the wrong file to the post by accident.
The correct VI is attached to this posting and I have renamed the search and display VI to "find refs.vi" as it is a more logical name.
I hope this helps,
Emma Rogulska
NIUK & Ireland


FindSahredVariablesProj.zip:
http://forums.ni.com/attachments/ni/170/191668/1/FindSahredVariablesProj.zip
Sima
2006-10-27 18:40:10 UTC
Permalink
Hi Sarah, this works great!
I added Find Variables.vi and Set References (SubVI).vi to one of my projects, and gave it a shot... works like a charm. Thanks a lot!
Loading...