LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

embed a file inside vi

I have some files that will be zipped. These should always be inclued with the VI (exe or whatever). I dont want them as external files... I would like them embedded inside of the VI.

 

Is this possible?

 

Thanks!

0 Kudos
Message 1 of 9
(3,269 Views)

No. At least not directly. You can, instead, use packet project libraries, a feature of LabVIEW 2010.

 

You can also handle that situation with an installer that will be sure to install the files at the same time as the VI.

0 Kudos
Message 2 of 9
(3,255 Views)

With scripting, you can use tags to put any data (including files) inside virtually LabVIEW object.

Use an invoke node, with the methods Tag.GetTag and Tag.Set Tag.

0 Kudos
Message 3 of 9
(3,240 Views)

Thanks.

 

However, I have LV 2009 and I cant open your example. Any chance you can save it for my version?

0 Kudos
Message 4 of 9
(3,223 Views)

You can't really embed files within a vi. You can embed VIs within some file formats (exe, lvlibp, llb), but not miscellaneous files. If your file needs to only be accessed through LabVIEW then instead of storing the data in a file you can store it in the VI via default values, constants, or data tags.

 

If you explain why you don't want the files separate from the vi we might have some better suggestions. For example if it's for ease of installing you could either make an installer or put code and data into a single zip file for the user to extract. To avoid any changes to the external files, you could embed the data in the VI, store a hash of the file in the VI, or data obfuscation. None of these could stop someone skilled who really wants to mess with it though. To limit changes to external files to authorized users then you could use data obfuscation.

0 Kudos
Message 5 of 9
(3,204 Views)

You could take the file, and load it 'binary' into an indicator. Change this to a constant. Now you need to restore it during runtime by writing the data to a newly generated file.

 

Felix

Message 6 of 9
(3,197 Views)

Here it is.

Note: It's not a program just a set of invoke nodes that you can use to store/retrieve/erase data

0 Kudos
Message 7 of 9
(3,158 Views)

I agree with Felix that yes you can stuff a file into a VI.

 

In the Obfuse Code thread post # 40 I posted an entry (that will not work since it is too old) that has a sub-VI stuffed into the diagram as a constant. THe example code write the file to disk and saves it as a VI then runs that VI to do the required work and at the end deletes the sub-VI.

 

So yes you can stuff a file into a VI.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 9
(3,142 Views)

Thanks for the replies guys.

 

Very helpful!

0 Kudos
Message 9 of 9
(3,129 Views)