02-12-2023 10:40 AM
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
02-12-2023 11:23 AM - edited 02-12-2023 11:24 AM
What part are you having problems with?
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:
I recommend ot look at the shipping examples, design templates and tutorials listed at the top of the forum.
02-12-2023 11:38 AM
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.
02-12-2023 11:47 AM - edited 02-12-2023 11:52 AM
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?