LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save waveform image to jpeg file by using button

I need to save image from my waveform by using a button and  I want to be able to name this file. Can someone show me how to do it? Thanks

0 Kudos
Message 1 of 4
(1,044 Views)

What part are you having problems with?

 

  1. Get image from the waveform?
  2. Save that image?
  3. The button to do so?
  4. How to name the file?

Typically you want a simple state machine. To define the file name, you can use a file dialog. You might want to do that in a parallel loop using for example an event structure so the dialog does not block the main loop. Create an event for the button change and fire up a file dialog, then grab and save the image. Create an event for the stop button so the parallel loop will also stop at the end.

 

 

Also:

  • Sorry, I don't have your drivers, so most of the code I see is broken. Cannot comment on these parts.
  • Please don't maximize the diagram and front panel to the screen.
  • Your outer case structure and "start" button makes no sense in terms of dataflow.
  • Maybe you want a simple state machine instead.
  • You are only showing one element of the LED array, there could be more. Same for CV%.
  • Most of your coercion dots could be eliminated by using correct datatypes.
  • Don't hide terminal labels on the block diagram. Give each terminal an intuitive name to keep the code clear ("boolean 2" is not a good name).
  • You can eliminate most of your scalar indicators by showing the digital displays of your chart.
  • ...

 

I recommend ot look at the shipping examples, design templates and tutorials listed at the top of the forum.

0 Kudos
Message 2 of 4
(1,024 Views)

I want to do some measuremnts, then stop the program and save the data from waveform to some folder on my PC. I want to save this file by clicking button for example "save the measurment" and name that file for example "measurment 1".

And I know that for now my program is a big mess but I will take care of that later. 

0 Kudos
Message 3 of 4
(1,014 Views)

Saving an image is very (very!) different from saving the data. You should also be aware that a chart only has a finite history, so if the buffer is full, the oldest data is irreversibly lost. Default is 1024 items).

 

Attached is how you would save an image. You can easily modify it to get the chart history data instead and save that to a file. How do you want the data to be arranged in the file? (Have headers? include time column? tab delimited text? binary? something else?). Do you want to generate the filename programmatically (e.g. always starting with "measurement", but with incrementing digits at the end?). What should happen if the file already exists?

 

Maybe the function Create File with Incrementing Suffix VI  could be useful?

 

altenbach_0-1676224055578.png

 

0 Kudos
Message 4 of 4
(1,006 Views)