LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

way to include sample data files into project

I have several normalized text files with data points (1024 rows, each row have one double value).  I would like to "include" these files into my application such that during usage, the values from the files are read into arrays using FileToArray.

 

Is there a way of including the files into the binary executable/distribution?  I know that I can include the *.txt files in the distro, but then they can be damaged by user.

 

The alternative I can think of is just to format the file into a double array declared in the program.  That then takes up a huge amount of whitespace in a source file.

0 Kudos
Message 1 of 5
(1,182 Views)

If you save your files in binary format you should be able to distribute them without being afraid they can be edited by anyone (I suppose you want to discourage accidental editing, not to prevent an intentional crack of your code).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(1,144 Views)

What I ended up doing was simply formatting it into a separate header file:

 

 

#define SAMPLE_DATA_KEV (const double[X123_RESOLUTION])	\
{	\
	-0.200258989,	\
	-0.131022924,	\
	-0.061786859,	\
	0.007449206,	\
	0.076685271,	\
	0.145921336,	\
	0.215157401,	\
	0.284393466,	\
...
		0,	\
		0,	\
		0,	\
		0,	\
	},	\
}0.284393466, \

 

 

Notepad++ to the rescue for formatting.

 

 

0 Kudos
Message 3 of 5
(1,053 Views)

I was under the impression that you did not like this solution. What have made you change your opinion?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(1,039 Views)

 I guess I didn't like the idea of having "dangling files" in the distro that could be damaged, and if so could be hard to repair, find, etc.  By by being in the source code, I can manage completely.  

 

Also, by having in a separate header file, the "messiness" of it is at least relegated to a dedicated file.

 

Hypothetically, it would be a fascinating feature of a graph control if you could "load" sample data into a plot on the control.  This would basically cover what I'm trying to do and would result in no latency when used in my UI.  It would behave like the DEFAULT_VALUE property of many other controls.  Hmmm.

0 Kudos
Message 5 of 5
(1,033 Views)