LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving a Acquisition Data and File in Jpeg Format

Hi Folks, I hae my Data Acquisition Application that logs and saves data in .tdms format.  Is it possible for me to save my acquired data in Jpeg format?  If it is possible, could any one kindly give me the suggestion on how I can code this behaviour?

 

I would appreaciate any help in this regard.

0 Kudos
Message 1 of 5
(2,379 Views)

Have you taken a look at this function yet? 

 

If you could provide more details of the data you are saving someone might be able to offer more specific advice. 

 

I hope this helps!

 

Cheers,

 

Andy C.

Applications Engineering

National Instruments 

0 Kudos
Message 2 of 5
(2,335 Views)

Hi Andy-C

 

Thanks a whole lot for your response to my question.  Yes, I have taken a look at the "Write to Jpeg" function before now.  I have coded a datalogging using the TDMS functions already on my application, and my concern is that is I could create two different paths or use the same paths within the same application, if I was going to include the "Write to Jpeg" function" in the same application.  That is my first confusion.  I have attached a snippet of what I have concerning the TDMS functions so far. 

 

Meanwhile, on my TDMS datalogging so far, it's really not achieving what I desire and I don't know if you or anyone could help out by telling me what to do.  The behaviour I want to achieve with the TDMS logging is that I have a boolean button on my front panel, which when it is clicked to say "Auto Save", my application should start logging data while, but should save data on files within incremental number in the same folder with subsequent Runs of the application.  The attached snippet is all I could put together but it is not doing what I want so far.

 

Thanks for your time and help.

Tebefia

0 Kudos
Message 3 of 5
(2,317 Views)

JPEG and TDMS are used for very different purposes.  JPEG files store images.  TDMS files store raw data of various sorts, both scalar and vector.  From your snippet, it appears you are storing waveforms.  TDMS is certainly your best bet to log waveforms to disk.  You can save an image of a plot of a waveform in a JPEG file, but it will take far more disk space and time to do it than storing the waveform itself, and the data will be far less usable.  In any case, the functionality you want does not have anything to do with the actual file format, but has everything to do with how you use it.


The behaviour I want to achieve with the TDMS logging is that I have a boolean button on my front panel, which when it is clicked to say "Auto Save", my application should start logging data while, but should save data on files within incremental number in the same folder with subsequent Runs of the application.

Tebefia


To do this properly, you need to learn about two design patterns - state machine and master/slave.  Please look in the LabVIEW help and on these forums for LOTS of information on these design patterns, then read the following. Your logging function is a state machine.  Your acquisition and user interface are masters to the logging function slave.  The logging should has at least two states (Idle, Logging) and handles transitions between them by creating and closing, respectively, the file.  When you create the first file, check for other files on disk to avoid a name collision.  After that, you can cache your current name in a shift register so the next time you create a file, you can easily increment the index.  The "Auto Save" button will do two things.  It will send a message from you user interface loop to your DAQ loop to start sending data to the logging state machine.  It will send a message to your logging state machine to transition from Idle to Logging.  When you close your program, you will need to send a message to the DAQ loop to quit and a message to the logging state machine to transition to Idle (close the file), then quit.  Messages are sent using queues.

 

This is a lot of information and will take awhile to work through.  You can hack together something in a single loop which will do what you want, but it will be easy to break and hard to extend.  If this is a one shot classroom assignment, you may want to do this.  If you are planning to use this program at all in the future, I would recommend you go the three loop UI/DAQ/Logging route.  Good luck!

0 Kudos
Message 4 of 5
(2,292 Views)

Hi DFGray:

 

Thanks for your response to my questions and even more importantly your effort to explain more.  I appreciate it.

 

Actually, I was studying more about Master/Slave and State Machines when I read your response to my questions.

 

Regards,

 

0 Kudos
Message 5 of 5
(2,285 Views)