Jump to content

For Loop runs once when told to run more.


mross

Recommended Posts

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

post-48-0-49559300-1298249375_thumb.jpg

Link to comment

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 by ShaunR
Link to comment

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

Link to comment

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.

Link to comment

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:

post-2399-0-79866400-1298493062_thumb.pn

(shift registers are your friend)

Ton

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.