02-19-2006 01:08 PM - edited 02-19-2006 01:08 PM
Message Edited by 1231 on 02-19-2006 01:08 PM
02-27-2006 12:07 PM
Hi
The N value is how many time the for loop iterates. The bigger the N value is the more times the for loop will iterative and the longer it will take to finish. So at the moment you have 1000 iterations at 10 milliseconds therefore it will take 10s to complete the for lope before it moves on to anything else. This will mean that it will take at least 10s between each iteration of the main while loop.
Regarding the for loop what are you actual trying to do? At the moment you are running the same proses on 1 bit of data (the input to the loop) 1000 times which intern will return the same value each time.
Making your code more efficient regarding your writing to a file. I would suggest you open the file before you start the while loop and just write to it within the while loop then close the file on exit of the while loop. This might not make to much difference as at the moment you aren’t running particularly fast.
Regards
Tim
NI
02-28-2006 05:58 AM
Hi
I wrote this little VI for you it probably isn’t completely what you are trying to do but might give you some ideas.
I have used a random number generator to create the data. The data is then written to a file in blokes of a set amount. The file is then written to, until it reached a maximum size.
The VI shows how to initialize a file before you start any acquisition, and only write to the file in the loop then close it once stop is pressed or the file has reached its maximum size.
If you use the terminate button during the code then the file wont get written to or closed properly and some data might be lost. You should never have to stop your code with the terminate button.
Hope this helps
Regards
Tim
NI