Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Save Trace as .TXT Text File
You may want to save data in a text format to be readable by humans, or you may want to export the data to a data presentation package that supports text files but not raw data.
This option saves data as plain ASCII text. It saves the data from the current display to a single-screen file, which contains data for 1024 samples per channel. All active channels will be saved, even if they are not currently displayed.
Each file is saved with a header that includes relevant information such as the type of data (Wave, Spectrum, Wave Average, etc), the number of frames for averages, the Daqarta Generator setup title (if applicable), and any user Notes. Label and Field data is included if present.
Data appears in columns separated by white space; it is not comma-separated. The first column is always the X-axis variable, followed by a column for each active channel. Columns are labeled with units and channel descriptions.
Here is an example showing the header and first few data points for a typical file:
Wave Average 32 frames Gen: Dual Sine Notes: Test of averaged Dual Sine output. L.Out R.Out msecs mVolts nVolts 0.0000000 138.1568898 -69.2794576 0.0226757 -16.5338515 -65.0880956 0.0453515 -169.8923098 -60.6441846 0.0680272 -309.5512367 -55.9753620 ... ... ...
Waveform files have 1024 lines of data, one for each sample. Spectrum files have 512 lines of data, one for each spectral line. If Spectrum Cursor Peak is active, the high-resolution readouts are included after the main data, following one blank spacer line.
The text file always includes the full waveform or spectrum, even if the display has been expanded to show only a small portion of it.
If the text file is to be read automatically by another program, you will need to "teach" that software how to read the file. You may have to specify that the data is separated by white space instead of commas, the destination for the data from each column, and what parts of the header to ignore. Please note that the header is not a fixed number of bytes, nor even a fixed number of lines. For example, if there are no Notes then that section is omitted; conversely, there can be many lines of Notes.
This option is disabled during DDisk recording, or when there are no active Input or Output (Generator) channels.
The SaveTXT macro has no effect if any File Open or Save As dialog is already active.
SaveTXT= without a name will open the Save As dialog showing all .TXT files, with the default set to Data or the most recent name.
SaveTXT="MyFile" will open the Save As dialog with the default name set to MyFile. (Note that quotes are needed around all filenames in macros.) If you accept this by hitting Enter or the Save button in that dialog, Daqarta will assume you want to save a file named MyFile.TXT. If that file already exists, you will be prompted to replace it.
After either of the above commands, you may use IF.Posn?f=0 to see if the user has hit Cancel instead of choosing a file name. This allows your macro to exit gracefully or take other action.
A.SaveTXT="MyFile" will save MyFile.TXT directly, without any Save As dialog. Note that if the file already exists, it will be overwritten without any confirmation prompt.
Similarly, if the Macro Variable Var0 holds a value of 12, then SaveTXT="Test"+Var0 will set a default file name of Test12. If you expect to use a large series of files, you can use SaveTXT="Test"+Var0(3) (for example) to set the decimal format to 3 integer places to get Test012. This will allow proper sorting by file name.
A.SaveTXT= will save directly using the current default file name. If you have previously set file names to Auto-Increment, either manually or using AutoInc=1, then this will save using the next file name (MyFile-001.TXT, MyFile-002.TXT, etc).
See Macro Variables for a way to use a Field to supply the initial name that AutoInc starts with.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved