LTspice: Importing & Exporting PWL Data

The LTspice waveform viewer is a handy way to perform basic measurements, but there are times when you need to export data from, or import data into LTspice to further evaluate a circuit.

To export waveform data to an ACSII text file:

    1. Click to select the waveform viewer
    2. Choose Export from the File menu.
    3. Select the traces you want exported.
    4. LTspice IV: Importing & Exporting Data
    5. Click browse to specifiy the file location and name to save the text file

Once this file is created you can analyze it further in applications like Microsoft Excel or MATLAB. Note that some applications like MATLAB expect imported files to contain only data, with no header information. If you need to remove the header, open the text file in a text editor or Excel and delete the header information.

To import waveform data into LTspice IV you must attach a text file as a piecewise linear (PWL) function in a voltage or current source.

LTspice IV: Importing & Exporting Data

The imported file must contain a list of two-dimensional points that represent time and value data pairs in a tab or comma delimited format—with no header information. The PWL function connects the dots in the data, constructing a waveform based on straight-line segments between the points defined in the text file.

LTspice IV: Importing & Exporting Data

To add a text file as a PWL function to a voltage or current source:

  1. Right-click the symbol in the schematic editor
  2. Choose advance
  3. Select PWL FILE: and click Browse to choose the text file.
LTspice IV: Importing & Exporting Data

The PWL statement is discussed in more depth is available in the previous LTspice blog.



Gabino Alonso

Gabino Alonso is currently the director of strategic marketing for the Power by Linear™ Group. Prior to joining ADI, Gabino held various positions in marketing, engineering, operations, and education at Linear Technology, Texas Instruments, and California Polytechnic State University. He holds a Master of Science degree in electrical and computer engineering from University of California, Santa Barbara.