LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Master Spreadsheet for specific file format

Hello Everyone, 

I have made a vi which can break down a file names and put the parameters in spreadsheet. This is for the company that I am working on and the VI is made to handle thousands of data file. I made the VI but it only works for specific set of files. For example the file name is Ring-1.300V_MZI1-0V_MZI2-0V.csv. 

the vi will break down in following way: 

Filename                                                   Ring             MZI1              MZI2

Ring-1.300V_MZI1-0V_MZI2-0V             1.300v             0V                 0V

I have bunch of files of this same category and the vi will take the list of file names and put the them in a spreadsheet. But I can only do it In this file name not for others. I have attached 2 sets of files and my VI. I was working on 1st set of files, i don't know how to make the 2nd setor any other file set work in the Vi. If somebody can show me then that would be great! Thank you. 

 

0 Kudos
Message 1 of 13
(3,982 Views)

1. You have race a condition with your Spreadsheet:Item Names property.  Instead of 2 property nodes, just use a wire.

2. Why don't you autoindex on the array of file names in the FOR loop.  That would eliminate a lot of your confusing code, including the Array To Spreadsheet String, Array Size, and Pick Line.

3. Some of your analysis is done on the "Spreadsheet String", which will only get the first file.  All of the analysis should be inside of the FOR loop.

4. The outer While loop is adding no value (unless you like using 100% of your CPU core to accomplish nothing).  Just remove it.

5. The Build Array can be reduced to a single input.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 13
(3,959 Views)

Hello crossrulz, 

Sorry for all the confusing codes. I am actually a new user so please bear with me. it seems like you have a lot of good suggestions, some of them won't make any sense to me unless I visualize. Do you think you can implement the suggestions you gave in my VI and post the refined file? If you can do that, then that would be helpful for me. Thank you!

0 Kudos
Message 3 of 13
(3,955 Views)

It would be useful to give some time to learn about it, ultimately it is your code.

You could check the learning material  online or take some training

https://www.ni.com/getting-started/labview-basics/

http://www.ni.com/training/

Message 4 of 13
(3,899 Views)

OK, I think I got it working at some degree. But it's not there yet. For example I still cannot properly break down the file name characters into smaller chunks. But the values encoded in file names can be properly extracted. Can somebody please check the VI and help me to enhance it? I also attached test data (csv files) so that people can test out my application. 

0 Kudos
Message 5 of 13
(3,851 Views)

I took a look at the VI that you attached, but it is a bit confusing what you mean by separating into smaller chunks. Could you elaborate more on exactly what functionality you are currently seeing as well as what you are wanting the functionality to be? Currently it looks like you are turning your array of files into a string and then doing regular expressions on the entire string. It may be easier to work with a for loop for this functionality. I think if you can clearly define what exactly you need as inputs and outputs it will help bring the functionality together.

Hunter D.
Applications Engineer
0 Kudos
Message 6 of 13
(3,806 Views)

Hi hdellere, 

Thank you for letting me know you were having confusion. I assume you have looked over the data files I attached in ZIP. I am not looking to do anything with the actual data of the files rather I want to extract the parameters/characteristics from the file names and put them in a spreadsheet. After that, I want to assign new names to these files of the same folder. the new names of the files will also go to the spreadsheet. These are the two functions that I was trying to get in my VI. At the end, I want to export the spreadsheet so that I can open them up in Excel. What the output should look like is attached here. I did have for loop earlier, then somebody told me to remove it. Hopefully, that will clarify your question, but if it's still confusing, then let me know. Thank you.

0 Kudos
Message 7 of 13
(3,780 Views)

Huqs,

 

I have a few questions / recommendations:

 

1. How are you generating the new file names? Are they supposed to be randomly generated or is there some connection to the original file name?

2. When using the build array function to make 'filenames' a 2D array, you don't need the empty array. Simply feed it into a build array with only one input and it will work.

3. Can you generate the headers of each column explicitly? Based on the files you sent it would be much easier to generate the headers with constants instead of indexing the array.

4. As per a previous post on this thread I would try to use the FOR loop structure instead of the spreadsheet to string. It would eliminate much of the unnecessary portions of your code and make things much easier.

Hunter D.
Applications Engineer
0 Kudos
Message 8 of 13
(3,775 Views)

1. The new file names will randomly be generated( although having a sequence in new names will help), there will not be necessary any connections to the previous names. I just don't know yet how to rename the files. 

2. I did what you said, this actually helped! Thanks

3. I did not quite get what you meant. 

4. I have been trying what you suggested.But I am struggling. But 'll probably continue to try. 

0 Kudos
Message 9 of 13
(3,763 Views)

For point three, I meant that if the naming convention of your files will always be the same you could simply generate the first row of the file explicitly. An example of that is attached. This removes the need to pull this information out dynamically from the spreadsheet string. For point four, take a look at how auto-indexing FOR loops work here:

http://digital.ni.com/public.nsf/allkb/B85025233861378A86256CE700491E34

Hunter D.
Applications Engineer
0 Kudos
Message 10 of 13
(3,758 Views)