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? 

0 Kudos
Message 1 of 13
(301 Views)

Hi gibb,

 

I thought I already recommended to use less local variables…

 

Suggestion:

check.png

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 13
(280 Views)

You may prefer to collect all data before saving:

example.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019
0 Kudos
Message 3 of 13
(277 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
(260 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
(251 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 Indexing.pngConditional Indexing

Bob Schor

Message 6 of 13
(237 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 Indexing.pngConditional Indexing

Bob Schor


I tried that but I still get an empty .txt file :\ 

0 Kudos
Message 7 of 13
(232 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! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 8 of 13
(212 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
(197 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
(153 Views)