# Is there a spice directive to export waveform data in LTspice?

http://www.linear.com/solutions/1815

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.

• I haven't used LTspice much but looking at the docs .WAVE might be worth a look, then maybe you could read that using Python. – PeterJ Aug 10 '14 at 6:11

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.

• I tried ltsputil.exe -x example.raw dete.txt & ltsputil.exe -c example.raw dete.txt. The former doesn't work, the later just gives me the same file as example.raw but with the name dete.txt (just like copy-paste). – Shashank Sawant Aug 11 '14 at 7:09
• You need to include an a with the -c as in: 'ltsputil.exe -ca example.raw dete.txt' . I also included the o to force overwrite of the existing file so it would be 'ltsputil.exe -cao example.raw dete.txt' That generates a text file for me but it will require some post processing. It would have been nice to get a csv out of it but the values are listed by trace in a single column. – mbyrne Aug 12 '14 at 19:25
• Yeah that worked. Thanks! I still have to figure out which simulations the data represents, but it's an excellent starting point. – Shashank Sawant Aug 12 '14 at 22:58

I'm sorry to necromance, but you can run LTspice with:

scad3.exe -ascii -b netlist.net


And it'll give you an ascii file output. You can combine this with the .save directive to get convenient output.

• Not sure you mean necromance but I'm willing to be taught. – Andy aka Sep 26 '15 at 15:07
• Necromance because the question is over a year old – Matthew Sainsbury Sep 26 '15 at 15:22
• Ah I see - get up to date is my advise LOL – Andy aka Sep 26 '15 at 15:38
• @Matthew Sainsbury please elaborate your answer where to add "scad3.exe -ascii -b netlist.net" – m_snaeem Apr 22 '17 at 12:11