06-19-2019 09:14 AM - edited 06-19-2019 09:17 AM
Hello, everyone. I want to write the data from this loop as a .txt file so that one column are the RxMsgCnt values and the other column are the Lambda Data values.
I searched online for some tutorials on how to save a XY data to a file and I found this one:
Which works for random numbers. I tried to incorporate it on the original loop but I can't make it work. Can anyone help me?
06-19-2019 09:43 AM
06-19-2019 09:52 AM
You may prefer to collect all data before saving:
06-19-2019 12:11 PM - edited 06-19-2019 12:11 PM
@pincpanter escreveu:
You may prefer to collect all data before saving:
I tried doing that but I got an empty .txt file. Can you check my diagram, please?
06-19-2019 12:53 PM
You inner case structures have terminals set to use default if unwired. Bad choice. Change that setting to be unchecked. Then go and wire your array wires through every case. (LInked tunnels can help here.)
The problem is that if you run a case that does nothing to that incoming array terminal and doesn't write it out at the exit of the case structure, you are just sending out an empty array which discards everything you had been building up in the shift register!
06-19-2019 02:26 PM
For at least 5 years, we've had Conditional Output Tunnels, in particular Conditional Indexing Tunnels. This means we don't need a Shift Register to selectively add new elements to an Array. This simplifies and clarifies the behavior of the VI. Here is an example:
Bob Schor
06-19-2019 02:51 PM
@Bob_Schor escreveu:
For at least 5 years, we've had Conditional Output Tunnels, in particular Conditional Indexing Tunnels. This means we don't need a Shift Register to selectively add new elements to an Array. This simplifies and clarifies the behavior of the VI. Here is an example:
Bob Schor
I tried that but I still get an empty .txt file 😕
06-19-2019 05:42 PM - edited 06-19-2019 05:49 PM
That Button to array to search to case - is the same as connecting the button to the case directly.
/Y
06-19-2019 08:04 PM
Are you sure any of the event cases that generate data are actually running? (probes or highlight execution can confirm.).
You don't a local variable of Error Code in each case of the case structure. Just put the terminal outside the case structure itself. (Use the local variable in your initialization part of the code. Since that part of the code only runs one, it makes more sense to put the local variable there. Use the terminal in parts of code that are run frequently.
06-20-2019 02:58 PM
@RavensFan escreveu:
Are you sure any of the event cases that generate data are actually running? (probes or highlight execution can confirm.).
You don't a local variable of Error Code in each case of the case structure. Just put the terminal outside the case structure itself. (Use the local variable in your initialization part of the code. Since that part of the code only runs one, it makes more sense to put the local variable there. Use the terminal in parts of code that are run frequently.
Yes, they are running. I can see on screen their values changing, but the .txt file always comes out blank.