05-15-2013 03:11 PM
I have written a program to analyze data from a large spreadsheet for my research. When I start the program, it asks me to select a file to analyze. I wanted to be able to run several files at once, so I put the code in a For Loop and made it so that I can choose several files at the start of the program. Then it analyzes one file at a time. However, only the 1st iteration of the for loop gives accurate data. The next iterations have accurate data until the end, where a bunch of it is either missing or jumbled. I don't understand how to fix it.
I triedchecking for race conditions by running it on "highlight", but it still did the same thing. The VI and all subVIs clear indicators when called and are reentrant, making a clone for each instance.
Any help would be appreciated!
05-15-2013 03:18 PM
How are you choosing your multiple files at the start? Could you put your various file paths into an array (outside the For Loop), then have the For Loop iterate on each path?
With regards to the jumbled data, would you be able to post your code up here, and even an example of how the data has been jumbled.
Thanks,
05-15-2013 03:27 PM
Hi Josh,
The post-doc I work for wrote a program that allows you to select several files and puts them in an array of file paths and then it's fed into a For Loop, so each file is analyzed one at a time.
I can post the code, but it's pretty big with many subVIs and only works with our specific data output spreadsheets, so I would have to send all of it. Will that work?
Thanks
~Kate
05-15-2013 03:44 PM
Yes a zip of the entire project would be helpful.
Look for Uninitialized Shift Registers. That is a likely culprit
05-15-2013 04:22 PM
@JÞB wrote:
Yes a zip of the entire project would be helpful.
Look for Uninitialized Shift Registers. That is a likely culprit
I was kind of thinking it has to do with trying to replace array elements when the other files are smaller. This would yeild old data left at the end of the array data.
05-21-2013 02:59 PM
Here is a zip file of the program and all the subVIs. The main program is "ExpandedAnalyzer (v4)" that runs the subVIs. There is also 3 sets of example data to try running with it. The problem only occurs if you run more than one file and you can see it either on the front panel under the last tab or in the results files that are created after the program has run.
Thanks for your help!
~Kate
05-21-2013 03:12 PM
Hi Katel,
the first (real) problem is to load all files at the beginning and putting their contents into a big 3D array. Your files have different sizes so you will have empty elements in your 3D array (maybe a lot of them)...
Then all of your code needs to be refactored. On my laptop most VIs span several times the screen size - I will not even start to debug something in there!
05-22-2013 10:37 AM
You have a TON of code that is just being copied. Make subVIs! You could reduce that main VI quite a bit just by making subVIs. And you might uncover some of your bugs as well. Because it is a lot easier to debug a small VI than the ginormous main VI you have there.