LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

path

Solved!
Go to solution

Hi, I have some TDMS file from a measure, now i want to read the files one by one and make average between the files but I can't find the way to call the files and include it for the average.

 

For an idea of my application I include a piece of my VI and some files.

 

Thanks in advance.

Download All
0 Kudos
Message 1 of 8
(3,082 Views)
Solution
Accepted by topic author Erardo

There are some missing subVIs, but in genereal you would do a "list folder" with a suitable pattern and then iterate over the list of files in a FOR loop.

 

Keep the sum in a shift register and divide by the number of files at the end to get the average..

 

 

(What is the purpose of the while loop? Typically you only need to spin the loop if on of the inputs changes. There is no need to re-read the same file over and over again as fast as the computer allows. Use an event structure! Why is the front panel and diagram maximised to the screen? Very annoying!)

0 Kudos
Message 2 of 8
(3,034 Views)

yes, I used a for loop and in the number of iterations I put a control, and these works like the number of averages between the files. 

 

Thanks for your support.

0 Kudos
Message 3 of 8
(2,959 Views)

@Erardo wrote:

yes, I used a for loop and in the number of iterations I put a control, and these works like the number of averages between the files. 


Why would you need a control for N?? Shouldn't the number of iterations be determined automatically by the number of files?

 

Feel free to post you code so we can give more detailed advice.

0 Kudos
Message 4 of 8
(2,950 Views)

because I don´t want to use all the file in a folder, so I change the while loop for an for loop just like you recommended and use a file dialog for call the files, for that reason I use the control for the number of iterations 

0 Kudos
Message 5 of 8
(2,927 Views)

Hi, Erado,

 

If you'd like to pick up some of the files in the directory manually, you can just use the file dialog by setting uncheck the "Limit selection to single item", and then you can just use for loop directly without specifying N.

0 Kudos
Message 6 of 8
(2,917 Views)

@Erardo wrote:

because I don´t want to use all the file in a folder, so I change the while loop for an for loop just like you recommended and use a file dialog for call the files, for that reason I use the control for the number of iterations 


So you simply process a random number of files? Seems pointless.

 

You should define the "pattern" for the list folder operation such that only the desired files match, then process all of them.

0 Kudos
Message 7 of 8
(2,893 Views)

Thanks for your answers and support. I used your care instructions and now I am comfortable with the result it is just what I needed.

 

Best regards.

0 Kudos
Message 8 of 8
(2,877 Views)