LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ordering the storage of file data into an array

Hi, 

 

 

I'm unsure how best to solve this issue I have with my program. 

 

I have a cluster into which I place information related to an experiement. in this clster one of the elements is an array and each element in the array contains another cluster which contains a file path and information relating to the file. Each test within an experiment will have multiple files that need to be read and analysed and so I want to store useful data about these. So, for example - experiment 1, test 1 will have 3 files (tdms, avi and wmv) each file path will need to be in one of the element of the arrays. Heres the tricky part, I need to the array to be able to accept any type of file in to any index so it is not possble to fix the type to an index to the file type. This is because I need the program to be as generic as possible in order to allow different experiments to be used with it - experiments will have different file requirements. So my question, I need a way to just put the clusters file paths and info into the next available index of the array but then somehow store that index as I will need that later. 

 

I'm not sure if I have described the problem clearly so please ask further questions. 

 

Thanks

Labview 14.0, Labview 12.0
CLAD
Mechanical Engineering Student
0 Kudos
Message 1 of 15
(4,291 Views)

Hi Stephen,

 

Probably would be helpful to post what code you do have.  Some of what you want almost sounds like an OOP project, but you may be able to handle it with variant data..



-Matt
0 Kudos
Message 2 of 15
(4,280 Views)

Hi Matt, 

 

Thanks for the reply 

 

I can't send any code at the moment as I have left work (will be able to tomorrow) but here is a screen shot of the type def cluster if it makes it any clearer.

My program is quite complex but the writing to cluster part is relatively simple. The program is an event driven state machine and at different cases I will need to write specific entries to the "task info array" that can be seen in the type def i sent as a picture. The index of each cluster of information associated with a file will need to be recorded as this will be written to in multiple cases. For example, in one case i may write the number of channels to it where as in another case i may write the file path and therefore need a nice way to keep track of where i have put each of the file paths.

 

In addition to storing the information I will be saving this to an ini file so then I can read back the information and run the vi that way rather that generating the data everytime its run. For example, instead finding the start time which is done using video analysis, I would like to just read in this information. 

 

Hope this is more clearer. 

 

Thank you

 

Labview 14.0, Labview 12.0
CLAD
Mechanical Engineering Student
0 Kudos
Message 3 of 15
(4,259 Views)

If you just need to keep track of the element based on the path of the file, Variant Attributes are extremely handy. Personally, I'd just store the entire element as a Variant Attribute and avoid messing around with keeping track of indices but YMMV.using variant attributes.png

0 Kudos
Message 4 of 15
(4,242 Views)

Thanks for that, this does look like it might solve the problem I have. One possible issue is that the clusters which I will be setting attributes to will themselves be in another cluster that will be saved in an ini file. Will the attribute of each cluster in the the array be saved to the ini file too and so I will be able to have a mode in which I can just read the ini file and thus just using the get variant attributes and not set them in the program.

 

Thanks 

Labview 14.0, Labview 12.0
CLAD
Mechanical Engineering Student
0 Kudos
Message 5 of 15
(4,218 Views)

Stephen,

 

Look into openG's ini file functions if you havent done so already.  I would suggest just downloading their entire add on from the VIPM because youll eventually find a use for some of their functions and its free.  But as far as creating an INI file these will save you a lot of headache and i think it will solve your problem.



-Matt
0 Kudos
Message 6 of 15
(4,200 Views)

Yeah I got the openG and I've tried writing to an ini file. They don't seem to save any attributes unfortunately. I'll keep looking for a solution though. 

 

Thanks 

Labview 14.0, Labview 12.0
CLAD
Mechanical Engineering Student
0 Kudos
Message 7 of 15
(4,197 Views)

Just to be clear you are just trying to write the cluster data to an INI file and then read it back? Can you provide an example of the cluster?



-Matt
0 Kudos
Message 8 of 15
(4,193 Views)

yes, I want to right the cluster to an ini file but the cluster will be populated at multiple points and then at the end of the program i will save to ini. the cluster is attached. 

 

Thanks 

Stephen

Labview 14.0, Labview 12.0
CLAD
Mechanical Engineering Student
0 Kudos
Message 9 of 15
(4,186 Views)

Oh, so the problem is that you are trying to fill in the attributes of the cluster and then once complete to write to an ini.  Well its just what gerd said in the other post, to use the bundle by name. You will have to give a label to all attributes that you will be writing to though.



-Matt
0 Kudos
Message 10 of 15
(4,184 Views)