mross Posted February 21, 2011 Report Share Posted February 21, 2011 Howdy all, I am learning to work with TDMS. Maybe that is the source of the problem... I have a for Loop that runs one pass and stops even though i have wire a 4 to the count terminal. I do TDMS open, run some arrays to the border for indexing. In the loop I want to TDMS Write some numbers, several times, then loop and pick up the next index, write, and so on. Outside the loop is TDMS Close and I call the File Viewer. I get no errors. I cannot get the loop to continue past the first iteration when it lets the output data go to the TDMS close and everything stops. I may be messing up the TDMS write somehow - the way it works is a bit perplexing so I keep thinking I have it and then it doesn't like what I did. But like I said no errors. I'd listen to advise. The wires are not pretty in the image as I have been tweaking, the open and close used to be outside the loop. Moving them inside changed nothing. Thanks, mike Quote Link to comment
jgcode Posted February 21, 2011 Report Share Posted February 21, 2011 Hi Mross What are the sizes of the array wired into the for loop? The smallest number determines the number of iterations. I am willing to bet one of them is equal to zero or one?? Cheers -JG Quote Link to comment
ShaunR Posted February 21, 2011 Report Share Posted February 21, 2011 (edited) The for loop will execute the number of times of the elements in the smallest indexing array regardless of what you wire to the N terminal. The N terminal is only of consequence if you have no array indexing or if the value you wire is less than the smallest indexing array.. I expect one of your data arrays is only 1 element in length. This, for example, will only execute 3 times because the shortest indexing array is 3 elements long. Edited February 21, 2011 by ShaunR Quote Link to comment
mross Posted February 21, 2011 Author Report Share Posted February 21, 2011 The for loop will execute the number of times of the elements in the smallest indexing array regardless of what you wire to the N terminal. The N terminal is only of consequence if you have no array indexing or if the value you wire is less than the smallest indexing array.. I expect one of your data arrays is only 1 element in length. This, for example, will only execute 3 times because the shortest indexing array is 3 elements long. Shaun and JG, I have been doing this for long enough you would think this little tidbit would have been noticed by me, but I have a habit of not auto-indexing when there are complications. This time I did it and noticed. Thanks for the help, Mike Quote Link to comment
hooovahh Posted February 23, 2011 Report Share Posted February 23, 2011 This is a big Gotcha for LabVIEW programmers at least once in their career. There will be times when you have two arrays, and index them both going into a for loop and the intent is that both are the same size, but if for some odd reason they are not there will be problems like this. Quote Link to comment
Ton Plomp Posted February 23, 2011 Report Share Posted February 23, 2011 This is a big Gotcha for LabVIEW programmers at least once in their career. There will be times when you have two arrays, and index them both going into a for loop and the intent is that both are the same size, but if for some odd reason they are not there will be problems like this. Or how do I lose a reference: (shift registers are your friend) Ton Quote Link to comment
jgcode Posted February 23, 2011 Report Share Posted February 23, 2011 Been there Quote Link to comment
ShaunR Posted February 23, 2011 Report Share Posted February 23, 2011 Been there ....done that...bought the tee-shirt..... Quote Link to comment
jgcode Posted February 23, 2011 Report Share Posted February 23, 2011 Ooh a t-shirt, I want one!! Quote Link to comment
Ton Plomp Posted February 25, 2011 Report Share Posted February 25, 2011 Ooh a t-shirt, I want one!! 'My colleague fixed my dumb auto-indexing-for-loop-bug And all I got was this t-shirt' Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.