07-21-2016 01:25 PM
Hello LabVIEWists,
I developed a little VI for monitoring and saving data. Unfortunately the while loop I use to ask for samples every iteration does not execture as fast as I demanded by placing a wait until next ms VI. Even if I change the time from 100ms to 10ms the execution speed does not change.
Does anybody has an idea why ?
Solved! Go to Solution.
07-21-2016 01:28 PM
The wait functions operate in parallel with your code! If your code takes a certain amount of time to run, say 352ms, putting a 100ms wait in is not going to speed things up.
07-21-2016 01:37 PM
File IO in general is slow. One thing you could do to speed up your loop is to move the Read Spreadsheet File VIs out of the loop and use autoindexing to iterate on your columns. You will probably need to use Transpose 2D Array to get it to index on the dimension you want. Also, your While loop should be a FOR loop.
07-21-2016 01:38 PM
Okay thank you Gregoryj,
So the better question would be, how can I make my code run fast? Or what is it in the code that needs that much time, because I have never had this problem in all the applications I built in the past.
07-21-2016 01:46 PM
In addition to what Crossrulz said, we may have to see what is inside the "Collect Numeric Array" subVIs
07-21-2016 01:52 PM
Moving the read from spreedsheet VIs out of the loop was the solution. Thank you guys!
07-21-2016 02:21 PM
@ZMK16 wrote:Moving the read from spreedsheet VIs out of the loop was the solution. Thank you guys!
Well, this is only a solution if the file names and file contents never change. The file names can't change (all controls are constants!), but if some other process updates these files, you would get a different result for inside vs. outside.
Why you are at it, also remove these "built array" nodes. converting a 1D array to a 2D array does not add any useful information, it just makes indexing harder.
And yes, the outer loop should be a FOR loop and just index over the three arrays (assuming that all files have the same number of points) and the loop should stop once you run out of elements. You keep indexing long after all available data is processed!