LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

determine unused variables in labview

Hi Sima,

I'm having a look into this for you but am just trying to get the references right. I'll post the code when I can.

Regards
Sarah

Applications Engineer | National Instruments | UK & Ireland
0 Kudos
Message 11 of 18
(1,841 Views)
Hi Sima,

I've had a play around with the example Emma posted and have managed to get it working for VIs that aren't in the library.

You'll have to put the names of the variables you're searching for in the array control on the front panel. This should be a starting point for you at least.

Let me know how you get on.
Sarah

Applications Engineer | National Instruments | UK & Ireland
Message 12 of 18
(1,839 Views)
Thanks Sarah, but could you please save the project down to version 8? I don't have 8.2 yet. Thanks.
0 Kudos
Message 13 of 18
(1,824 Views)
Hi Sima,

Here is is in version 8.

Regards,
Sarah

Applications Engineer | National Instruments | UK & Ireland
0 Kudos
Message 14 of 18
(1,822 Views)
Thanks Sarah. I have another question for you. This works well with single-process shared variables. Why doesn't it find networked shared variables?
0 Kudos
Message 15 of 18
(1,811 Views)
Hi Sima,

This VI doesn't work for network published shared variables because of the way these variables are implemented in LabVIEW. If you change the 2nd variable in the project to network published and probe the output from the Callees Paths property node you will see the difference in the two.

Single process shared variables are saved in the same location as the project as part of the project library. When you use network published variables you are actually making a call to a subvi in the vilib library in the LabVIEW program files folder. Specifically:
C:\Program Files\National Instruments\LabVIEW 8.2\vi.lib\variable\NGread_imp.vi

It calls the same VI no matter what you call the variable or what the data type is (although there's a NGwrite_imp.vi for variables you write to). I think there may be a way of doing it by reading the VI as a string and searching for the variable name that way...

Leave it with me and I'll look into it a bit more today.

Regards,
Sarah

Applications Engineer | National Instruments | UK & Ireland
Message 16 of 18
(1,797 Views)
Hi Sima,

I wrote some code (which I'm very proud of!) that checks through all the VIs in a project, opens the VI as a text file and searches it to see if it uses any of the variables in the project.

It will find VIs in the project, in Libraries and in folders. Unzip the attached file, open the project then open the Find Variables VI. I've documented the block diagram so hopefully it will be self explanatory but if you've any questions just let me know.

Regards,
Sarah

Applications Engineer | National Instruments | UK & Ireland
Message 17 of 18
(1,770 Views)

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!

0 Kudos
Message 18 of 18
(1,736 Views)