LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save data

Hi,

I tried to save data (5 temperatures & 4 pressures) to excel file, but I couldn't. My vi file is attached here. Would you help me by modify the code including data saving part?

Thanks

0 Kudos
Message 1 of 40
(343 Views)

You do not have any saving in your code at all. Have you tried looking in the LabVIEW examples? This is an easy thing to accomplish. Go to the top menu and find examples. This will help move you along for the next time you are having an issue.

 

aeastet_0-1737050453863.png

 

Tim
GHSP
0 Kudos
Message 2 of 40
(326 Views)

Some general comments:

 

  • Never ever turn terminal labels into empty strings, ever! You can change the visibility on the front panel if needed. All terminals on the diagram should have a unique label.
  • Your thermometers and gauges can display their digital display (right-click....visible items...), eliminating 50% of the terminals. (You could even use arrays of indicators, simplifying things even more!
  • Index array is resizable and if you don't wire indices, you get the elements in order.
  • resizing formula nodes so you don't see their code is confusing. You should very rarely (=never!) even need formula nodes.
  • Now built a better state machine that allows saving.
  • Does it really (really!?) need to be excel or would tab delimited text be sufficient. You probably want to open the file before the loop, append new lines with each iteration (or on demand), and close the file when done. This would be much more convoluted in excel.

 

Here's how your code could look like:

 

altenbach_0-1737057023033.png

 

0 Kudos
Message 3 of 40
(304 Views)

Thanks Knight Of NI.

But the pressure should be multiply by 30 then divided by 10 : P= (measured data * 30)/10.

Thanks

 

0 Kudos
Message 4 of 40
(272 Views)

Hi alhaheeb,

 


@alhabeeb wrote:

But the pressure should be multiply by 30 then divided by 10 : P= (measured data * 30)/10.


So you want to multiply by 3 and add an offset of 0!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 40
(263 Views)

@alhabeeb wrote:

Thanks Knight Of NI.

But the pressure should be multiply by 30 then divided by 10 : P= (measured data * 30)/10.


 

Sorry, I did not look too closely and multiplying then dividing is somewhat silly and anti-intuitive, especially if we do the temperatures first. Debugging and validating is important and always needed and we would have found the problem in the next step, of course. Since I don't have your hardware, that's up to you. 😄

 

Just use Gerd's suggestion above. Trivial!

0 Kudos
Message 6 of 40
(250 Views)

Thanks a lot, the code is much better now.

Back to my question about data saving.

I used "write delimited" as shown in the attached file, but when I wire the date to 2D, I have a broken wire (different data type connection). When I wire them to 1D, it shows no error, but  I don't have pop up the saving window when I stop measuring! 

0 Kudos
Message 7 of 40
(208 Views)

You only have a 1D array because onyl the last measure value will be in the output tunnel and saving will not staurt until the while loop stops (and if you abort the VI, all data will be lost!)

 

What exactly do you want to save? All data? Just the last reading?

If you want to save all data as it is acquired, open the file before the loop, append a new row with each iteration, and close the file when the loop ends.

 

Your stop button still has no label! to hide the label on the front panel, change the visibility (right-click...visible items), not change it to an empty string!

0 Kudos
Message 8 of 40
(192 Views)

Yes, I want to save data as it is acquired every 5 min for example.  

0 Kudos
Message 9 of 40
(172 Views)

What is the loop rate? So you only want to save a row every five minutes? Just place the save operation in a case structure that activate every five minutes.

 

Here's a quick skeleton to save as I already described earlier. All you need to add is the conditional saving based on elapsed time.

 

altenbach_0-1737447581115.png

 

0 Kudos
Message 10 of 40
(167 Views)