09-15-2020 10:51 AM
Hello everyone!
How can I convert multiple files to ".txt"?
I was able to achieve this by creating this workflow but for each conversion, it asks me to select the file to convert and then to select the folder where I want to output it. Is there a smarter way to perform this conversion?
The files are named: " 1_good ", " 2_good ", " 3_good ", " 4_good ", " 5_good "...
Thank you in advance for your help!
PS: I've also uploaded my algorithm, called " ConvertFIle.vi "
Solved! Go to Solution.
09-15-2020 11:02 AM
Use list folder with a suitable pattern (or generate the filenames based on incrementing numbers) and iterate with a FOR loop. What is the extension of the input files? Make sure you exclude the output files in the match.
Here's a quick draft to get you started:
09-15-2020 11:28 AM
The file doesn't have an explicit extension. I couldn't identify it.
This is my first day using LabView, I couldn't find all the functions that you used, like the one after the block "file.txt".
Could you help me?
09-15-2020 11:28 AM
This is what I could reproduce.
09-15-2020 11:48 AM
Hi Jack,
@JackRen3 wrote:
This is my first day using LabView, I couldn't find all the functions that you used, like the one after the block "file.txt".
It's a string function, found in the string functions palette…
When it is your first day with LAbVIEW you should start with the Training resources offered in the header of this LabVIEW board!
09-15-2020 04:06 PM - edited 09-15-2020 04:46 PM
I started looking on the documentation but I was hoping anyone here could help me to understand how to perform this task.
I was able to reproduce the suggestion given to me but I don't understand how I should make work the "for loop" and how to let the algorithm choose the files iteratively. I run the algorithm, it asks me to select the folder but then it doesn't work, it seems it doesn't select the files. I know that something in the workflow is missing but I don't know what.
Thank you again for your help
09-15-2020 06:34 PM
What's the size of the array of filename coming out of "list files"? If there are no matching files, the loop will iterate zero time. Can you attach your VI?
09-16-2020 12:26 AM
Here it is my VI.
With size of the array you mean the number of files to output? If so, i have to convert 475 files and at the output I want those files to be in .txt, so I need 475 files again.
Thank you very much for the support.
09-16-2020 02:52 AM
Simple troubleshooting:
I meant wire an "array size" to the array coming out of "list folder". If things are correct, the size should be around 475, but if the pattern is wrong, it could be zero. You also might want to create an indicator to the iteration terminal to see what's happening. Are you sure you are selecting the correct folder?
Can you attach one of the data files here? (Place it in a zip file so the forum does not reject it). Does it have unicode or other unusual characters in the filename?
09-25-2020 04:47 AM
Thank you, your solution above worked and I could perform the conversion for all the files.
My last question is this:
In my folder I not only have files called "NUMBER_good" but also files named "NUMBER_warning" or "NUMBER_bad".
How can I help the program to understand that multiple names in the folder are possible?
An example of a list of files in the folder is:
1_good
2_good
3_warning
4_good
5_bad
6_warning
...
Thak you in advance