LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save data continuously from loop

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.

original loop.png

I searched online for some tutorials on how to save a XY data to a file and I found this one:data saving.png

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? 

Download All
0 Kudos
Message 1 of 13
(6,132 Views)

Hi gibb,

 

I thought I already recommended to use less local variables…

 

Suggestion:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(6,111 Views)

You may prefer to collect all data before saving:

example.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 13
(6,108 Views)

@pincpanter  escreveu:

You may prefer to collect all data before saving:

example.png



I tried doing that but I got an empty .txt file. Can you check my diagram, please? 

0 Kudos
Message 4 of 13
(6,091 Views)

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!

Message 5 of 13
(6,082 Views)

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:

Conditional IndexingConditional Indexing

Bob Schor

Message 6 of 13
(6,068 Views)

@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:

Conditional IndexingConditional Indexing

Bob Schor


I tried that but I still get an empty .txt file 😕 

0 Kudos
Message 7 of 13
(6,063 Views)

That Button to array to search to case - is the same as connecting the button to the case directly.

Boolean Unrubed.png

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 8 of 13
(6,043 Views)

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.

Message 9 of 13
(6,028 Views)

@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. 

0 Kudos
Message 10 of 13
(5,984 Views)