"Ali Shahabi" wrote in message <n3g66f$fac$
1...@newscl01ah.mathworks.com>...
> I'm working on automating LTspice using MATLAB (I could call LTSpice from MATLAB and run my simulation.) However, I need to add a directive in LTSpice from MATALB (I need this for a general-purpose automation. I can add the directive to the simulation file myself, but in that case whenever the simulation file is changed, the directive should be add again manually. I want an automated way.) For example, I need to add the following directive to my LTSpice simualtion file using MATLAB so that I don't have to add a directive manually whenever the simulation file is changed:
>
> .inc setup.txt
>
> I would be thankful if anyone could help me. thanks.
LTspice files are simple text files... Open on up in a text editor to see for yourself.
For .asc schematics, just append a line to the .asc file with the following format:
TEXT <xcoord> <ycoord> <justification> <fontsize> !<spice_directive>
where <xcoord> and <ycoord> are the x and y coordinates where you want to place the line in the schematic,
<justification> can be one of the following: Left Right Center Top Bottom Invisible,
<fontsize> is an array index (0-based) into the following array: [0.625, 1.0, 1.5, 2, 2.5, 3.5, 6, 7],
<spice_directive> is your ".inc setup.txt"
Note that if you want to just include a comment it is a semicolon ; instead of an exclamation mark !
Alternatively, you can just generate a .net from your .asc (using the -netlist command line switch), which is also just a simple text file, and add the your spice directive before the .end.
If you don't want to change the original file, then just copy it to a file with a different name and modify that one instead.
The best way to figure this out is to play with the text version of the .asc and then open it in LTspice and see what happens. Note that I'm using LTspiceXVII, not IV. There may be some differences but I doubt it.