06-16-2010 04:31 PM
I want to open several files and combine them. I attempted to make a for loop with variable number of iterations depending on how many files I intend on combining. In the for loop I placed a Read From Spreadsheet. When I run the vi with highlight execution on, it runs perfectly - exactly how I intended. When I run without, it read from spreadsheet always tries to open one more file than the number I told it and subsequently crashes. I can't figure out what is happening because it runs fine when I am trying to debug it.
Thanks for you help!
Solved! Go to Solution.
06-16-2010 07:31 PM
Please do a little code cleanup. You have some backwards running wires making your code hard to decipher.
What you've shown with a 1 going into the For Loop should open a file for reading one time. (It will pop up a dialog asking you for the filename.)
Then later it will open up 1 file to write out data, (again popping up a dialog asking you for another filename.)
Normally, someone saying "it works with highlight execution on, but not normally" is a sure sign they have a race condition due to abuse of local variables. But I don't see any of that in the code you posted.
If this screenshot doesn't represent what you are really running, then please post a .vi with a couple of example files so we can try out your code to figure out what you are doing.
06-16-2010 09:05 PM - edited 06-16-2010 09:08 PM
Why do you have shift registers in your for loop? The loop is only iterating one time so the updated value is in the shift register is never being used.
I'm guessing it is because this is a prototype of your actual code because it doesn't read multiple files, but if not then you don't even need the for loop. And as Ravens said, if it's not your actual code there may be something missing from this that is causing the problem
06-16-2010 10:22 PM
Sorry if it's a little messy - as imstuck said this vi is something that I slapped together quickly to manipulate some data. I made the loop iterate once with a constant to try and eliminate sources of error.
I fixed it a little while ago. I had the file I was trying to load open in excel and closing excel fixed the problem. I don't know if this is a common problem with labview (it doesn't happen at all when I have the files open with notepad). In case someone else comes across this problem, closing the excel document fixed it completely.
06-16-2010 10:26 PM