Electronic – spice directive to export waveform data in LTspice



The above web-page explains how to export the waveform data to a text file. You basically run the LTspice simulation, clicking on the waveform window, go to File>>Export, chose the variable to be exported and then specify the filename (usually a .txt is convenient). I am looking for a spice directive (or any other command) to automate this process.

I can run the spice file through LTspice using the command line. However, to export the waveform data, I still need to access the GUI. This is botching up my plan to use a python script to simulate the circuit for varying parameters. Any insights are appreciated.

Best Answer

I don't think you can generate a txt format directly from the ltspice command line. I recently looked into this and I came across an old discussion which includes the primary author of LTSpice and indicates (at least as of 2003) 1) you can't export text directly from the command line, 2) the binary format is intentionally "secret", 3) there is a separate executable available to do a translation. ( http://www.electronicspoint.com/threads/pspice-global-parameters-time-and-temperature.25088/ note that although the link says pspice, ltspice is also discussed)

So I think the best option is a two step process. 1) run the simulation from command line to generate binary data output 2) run the conversion utility from the command line to generate txt format

You can get the conversion utility "ltsputil" from the yahoo LTspice users group (https://groups.yahoo.com/neo/groups/LTspice/files/%20Util/ltsputil/) and its usage seems to be fairly well documented but with no guarantee it is 100% correct in output or that it won't break in future LTSpice.

I didn't try it yet but may in the near future. Please let me know if you have success with it.