Jump to content

Write data to a file


Recommended Posts

Hello,

I am trying to write selective data to a file. By "selective", I mean I want the users to turn a on/off switch to only save the data that they like. So I figured if I put my data through a Case loop and wire an On/Off button to it, that will do the trick. Attached is my vi. I have two problems with it.

1. Some how, even I put everything in a while loop, the execution stops after 1 iteration. Can anyone help explain?

2. For my Case loop, I hope that the False case would not give any data, but that's not the case. False case gives "0". Is there a better way to do this?

Your respons is much appreciated.

MC

Download File:post-4960-1148504903.vi

Link to comment

MC,

You are not far from the basic premise of what you are trying to do...

1. To get your loop to run for more than 1 iteration right-click on the boolean (wired to the stop indicator) and select "change to control". Now when you run the program the loop will iterate until the control is pressed to True.

2. Instead of casing out the data value itself, I would recommned incorporating the file write operation into the case structure. This way the file will only be written when the boolean is ON (True). This should get you started.

3. Might I also suggest adding a small loop delay to control how fast your loop iterates (slow it down to allow your PC to handle other processes).

Hope this helps...

ES

Hello,

I am trying to write selective data to a file. By "selective", I mean I want the users to turn a on/off switch to only save the data that they like. So I figured if I put my data through a Case loop and wire an On/Off button to it, that will do the trick. Attached is my vi. I have two problems with it.

1. Some how, even I put everything in a while loop, the execution stops after 1 iteration. Can anyone help explain?

2. For my Case loop, I hope that the False case would not give any data, but that's not the case. False case gives "0". Is there a better way to do this?

Your respons is much appreciated.

MC

Link to comment
MC,

You are not far from the basic premise of what you are trying to do...

1. To get your loop to run for more than 1 iteration right-click on the boolean (wired to the stop indicator) and select "change to control". Now when you run the program the loop will iterate until the control is pressed to True.

2. Instead of casing out the data value itself, I would recommned incorporating the file write operation into the case structure. This way the file will only be written when the boolean is ON (True). This should get you started.

3. Might I also suggest adding a small loop delay to control how fast your loop iterates (slow it down to allow your PC to handle other processes).

Hope this helps...

ES

That's awsome. It worked now. Thanks for your help ES.

MC

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.