labview >> What is the advantage of using For loop?
<br><blockquote><hr>Donald wrote:<br><blockquote><hr>altenbach wrote:<br>Anyone have a link?<br><hr></blockquote><br>I can?t find where I stuffed one of Greg McKaskle?s more detailed explanations (may have lost it during Y2K?), but way down in AppNote 168: <a href=" http://zone.ni.com/devzone/conceptd.nsf/webmain/732CEC772AA4FBE586256A37005541D3" target=_blank> LabVIEW Performance and Memory Management </a> ... p15 of the pdf ... there?s a paragraph that I needn?t quote because it just repeats what everyone has said above.<br><br>But if Thunderbird hasn?t read the AppNote already, it?s a worthwhile exercise.<br><hr></blockquote><br><br>If I remember correctly LabVIEW starts with some arbitrary array size for autoindexed array outputs on while loops such as a few hundred or thousend elements and everytime it runs out of elements that array is doubled in size. So a while loop will be slower than a for loop in any case as LabVIEW needs to do always at least one allocation (and you have to calculate a termination criteria inside the loop somehow too) and at the end one resizing but the performance hit is not that bad. Of course if you can, it is always a good idea to use for loops, even just for the benefit of not having to wire up a termination condition<br><br>Rolf Kalbermatter