09-03-2014 01:52 PM
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.
Solved! Go to Solution.
09-03-2014 05:12 PM - edited 09-03-2014 05:14 PM
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!)
09-06-2014 01:53 PM
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.
09-06-2014 02:34 PM
@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.
09-06-2014 07:38 PM
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
09-06-2014 08:08 PM
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.
09-07-2014 01:31 AM
@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.
09-07-2014 08:40 AM
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.