From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert multiple files to .txt

Solved!
Go to solution

Get the list for each file type, then combine them in a single array.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 11 of 21
(863 Views)
@GerdW wrote:

 

When it is your first day with LAbVIEW you should start with the Training resources offered in the header of this LabVIEW board!



@JackRen3 wrote:

I started looking on the documentation but I was hoping anyone here could help me to understand how to perform this task.


GerdW directed you to the LabVIEW Training resources because you're likely to better understand the answers and reach the end of your project sooner with the help of some training. The help that you receive here will be of much more benefit, and you will understand how to perform the task much quicker, with the training resources. 

Message 12 of 21
(855 Views)

When I start the algorithm, I select the file to convert and it gives me this error:

Schermata 2020-12-06 alle 21.46.37.png

How can I solve this?

 

 

I have also an additional question: I have to convert a lot of files into .txt format and the file's names are in different formats, such as:

1_good

2_good

3_bad

3_badop

They change the title after the underscore symbol.

 

How can I make my LabView program iterate over the files inside the folder that I select, and to convert all of them in .txt? 

For example, I run the LabView algorithm and it lets me select the folder and after that, it starts converting all the files inside of it. Could you help me?

 

I've been trying to figure it out for months how to make it work...I was asked to do this file conversion, but LabView is not my field and this is just one step that I need to overcome for a project. 

 

You'll find my script in the attachments.

 

Thank you so much.

 

 

 

0 Kudos
Message 13 of 21
(808 Views)

Hi Jack,

 


@JackRen3 wrote:

I have to convert a lot of files into .txt format and the file's names are in different formats, such as:

1_good

2_good

3_bad

3_badop

They change the title after the underscore symbol.

 

How can I make my LabView program iterate over the files inside the folder that I select, and to convert all of them in .txt? 

For example, I run the LabView algorithm and it lets me select the folder and after that, it starts converting all the files inside of it. Could you help me?


Don't use a pattern like "*_good*" when you want to process filename with a pattern like "*_*"!

(You could use an array of possible patterns like [*_good*, *_bad*, *_badop*]. Then use a FOR loop to find all files for your conversion task. Keep in mind: searching for "_bad" will also find files of the "_badop" pattern…)

 


@JackRen3 wrote:

When I start the algorithm, I select the file to convert and it gives me this error:

Schermata 2020-12-06 alle 21.46.37.png

How can I solve this?


You try to use Waveform files and save them into spreadsheet (TXT) files. Are those files really waveform files?

Can you attach a file where you get that error message?

To get rid of the error dialog you only need to handle the error programmatically!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 21
(793 Views)

Thank you so much for your answer.

 

 


@GerdW  ha scritto:

Don't use a pattern like "*_good*" when you want to process filename with a pattern like "*_*"!

(You could use an array of possible patterns like [*_good*, *_bad*, *_badop*]. Then use a FOR loop to find all files for your conversion task. Keep in mind: searching

for "_bad" will also find files of the "_badop" pattern…)

How can I do that? Sorry for the request, but can I ask you how to achieve this? I'm new to LabView, I will have to use this program just once, since this is not my field. I've been struggling for months on how to do this and on how to make it work.

 

You try to use Waveform files and save them into spreadsheet (TXT) files. Are those files really waveform files?

Can you attach a file where you get that error message?

To get rid of the error dialog you only need to handle the error programmatically!


Yes those are waveform files, I attached a folder of example.

0 Kudos
Message 15 of 21
(789 Views)

Hi Jack,

 

a simple approach:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 21
(793 Views)

I was able to replicate most of what you showed me, but I couldn't find the outer structure "Kein Fehler". Also I couldn't find the very external green element on the right of your sketch.


@GerdW  ha scritto:

Hi Jack,

 

a simple approach:


Here is my replica up to now, my constants array is dimmed, should I activate something?

Schermata 2020-12-07 alle 12.54.15.png

0 Kudos
Message 17 of 21
(782 Views)

Hi Jack,

 


@JackRen3 wrote:

I was able to replicate most of what you showed me, but I couldn't find the outer structure "Kein Fehler".


Did you ever use a case structure before? Do you know you can connect an error wire to its selector input as I did in my snippet? Did you implement some error handling before at all? ("Kein Fehler" is German for "no error"…)

 


@JackRen3 wrote:

Also I couldn't find the very external green element on the right of your sketch.



Did you ever create any frontpanel elements? Do you know their representation in the block diagram is called "terminal"? The loop creates a path array on its loop border, so the indicator to the right is an array of path…

 


@JackRen3 wrote:

Here is my replica up to now, my constants array is dimmed, should I activate something?


In my snippet that constant is an array of strings: why did you create an array of cluster of strings?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 21
(778 Views)

Thanks GerdW, you're being extremely helpful, I'm struggling with this process since September. 

 

Unfortunately this is my first time with LabView, I'm not an expert because it doesn't belong to my field. I just need to get this done for a project, but I cannot go on if I'm not able to convert these signals.

Still, I wasn't able to create the green element at the very end. 

I followed this guide but it didn't help me: NI HELP 

 

 

@GerdW  ha scritto:

 

Did you ever create any frontpanel elements? Do you know their representation in the block diagram is called "terminal"? The loop creates a path array on its loop border, so the indicator to the right is an array of path…

 


After creating the green element on the right, I should add the 2 blocks for the conversion from analog to txt? Right?

Schermata 2020-12-07 alle 14.36.52.png

 

Thank you so much again for your help.

0 Kudos
Message 19 of 21
(772 Views)

Hi Jack,

 


@JackRen3 wrote:

Thanks GerdW, you're being extremely helpful, I'm struggling with this process since September. 


More than 2 months should be a lot of time to take the training resources offered in the header of this LabVIEW board!

 


@JackRen3 wrote:

After creating the green element on the right, I should add the 2 blocks for the conversion from analog to txt? Right?

Schermata 2020-12-07 alle 14.36.52.png


I used a "conditional output tunnel" at the FOR loop! Use the context menu of the tunnel (aka right-click menu) to set it to "conditional": each filename is checked in the loop and added to the output when the condition is met…

The loop gives you an array of valid paths: you need to use a loop to autoindex each element in this array and do the conversion. (You might also do the conversion inside my FOR loop, based on the condition evaluated in the loop! I just made that snippet to show a solution to your current problem: programming also means to be able to split a big problem into smaller problems and solve them one by one…)

 

The different modes of "loop tunnels" and "autoindexing arrays" are very very basic LabVIEW stuff: you really should have learned that in the last 2 months!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 20 of 21
(755 Views)