clc clear all netlist = ['D:\Profile\a2679\Desktop\LTSpice\Test\Tandem_3T-series_1step.net'] %The function num2str() is your friend for doing this. For example, if instead of just changing the frequency to 5k, I had a variable named ‘frequency’ I could embed ‘num2str(frequency)’ in place of ‘5k’ in the netlist. The rest is standard Matlab programming. code=['d:\\Profile\\a2679\\Desktop\\LTSpice\\Test\\Tandem_3T-series.asc\r\n'... 'V1 N001 0 0\r\n'... 'D1 N001 N002 {dio2}\r\n'... 'I1 N002 N001 {I1}\r\n'... 'I�l2 N003 N002 {I2}\r\n'... 'D2 N002 N003 {dio1}\r\n'... 'V2 N002 0 {V2}\r\n'... 'R1 0 N003 0.0001\r\n'... '.model D D\r\n'... '.lib d:\Profile\a2679\Eigene Dateien\LTspiceXVII\lib\cmp\standard.dio\r\n'... '.model dio1 D(Is=1.61E-14 N=1)\r\n'... '.step param V2 0.5 0.74 0.01\r\n'... '.dc V1 1.7 2.1 0.01\r\n'... '.model dio2 D(Is=1.61E-14 N=1)\r\n'... '.step param Eg list 100 101 102\r\n'... '.param I1 table(Eg,100,0.010181,101,0.002396,102,0.00135,103,0.00148,104,0.004685,105,0.009347,106,0.004385,107,0.00293,108,0.004306,109,0.001085,110,0.002713,111,0.007115,112,0.01176,113,0.009205,114,0.012395,115,0.010637,116,0.007705,117,0.003889,118,0.004473,119,0.004458,120,0.007028,121,0.004424,122,0.004744,123,0.002317,124,0.001604,125,0.001408,126,0.003859,127,0.005497,128,0.009094,129,0.009142,130,0.007416,131,0.004846,132,0.00441,133,0.000897,134,0.002066,135,0.006125,136,0.009597,137,0.011969,138,0.013016,139,0.012656,140,0.01093,141,0.007997,142,0.004145,143,0.001133,144,0.004098,145,0.004698,146,0.009444,147,0.009854,148,0.008939,149,0.005758,150,0.003959,151,0.001223,152,0.002135,153,0.006237,154,0.009744,155,0.012185,156,0.013314,157,0.013014,158,0.011275,159,0.00828,160,0.004387,161,0.00166,162,0.002527,163,0.002312,164,0.012179,165,0.013252,166,0.01289,167,0.011157,168,0.008181,169,0.004366,170,0.002175,171,0.006249,172,0.009724,173,0.01213,174,0.013246,175,0.012925,176,0.011234,177,0.00831,178,0.004482,179,0.001671,180,0.004339,181,0.003284,182,0.003467,183,0.002864,184,0.002384,185,0.004548,186,0.002662,187,0.001317,188,0.004753,189,0.007418,190,0.009172,191,0.009445,192,0.009707,193,0.007909,194,0.002901,195,0.004758,196,0.002353,197,0.006536,198,0.010079,199,0.012509)\r\n'... '.param I2 table(Eg,100,0.007164,101,0.001488,102,0.000744,103,0.000878,104,0.003188,105,0.006669,106,0.002929,107,0.001904,108,0.002883,109,0.000592,110,0.001763,111,0.005051,112,0.008361,113,0.006486,114,0.008775,115,0.007555,116,0.005518,117,0.002833,118,0.00299,119,0.002953,120,0.004828,121,0.002926,122,0.003169,123,0.001443,124,0.000932,125,0.00089,126,0.002673,127,0.003806,128,0.006457,129,0.006455,130,0.005164,131,0.003269,132,0.003,133,0.000468,134,0.001526,135,0.004491,136,0.006925,137,0.008566,138,0.009284,139,0.009027,140,0.007825,141,0.005776,142,0.00305,143,0.000623,144,0.002859,145,0.003203,146,0.006757,147,0.007037,148,0.006364,149,0.003991,150,0.002686,151,0.000692,152,0.001598,153,0.004606,154,0.007067,155,0.008753,156,0.009515,157,0.00929,158,0.008073,159,0.00598,160,0.003233,161,0.001112,162,0.001629,163,0.00148,164,0.008762,165,0.00951,166,0.009254,167,0.008036,168,0.005941,169,0.003221,170,0.001577,171,0.004517,172,0.006934,173,0.008591,174,0.009356,175,0.00913,176,0.007957,177,0.005925,178,0.003241,179,0.001074,180,0.002983,181,0.002122,182,0.002255,183,0.001848,184,0.001524,185,0.00303,186,0.001692,187,0.000744,188,0.003387,189,0.005297,190,0.006544,191,0.006719,192,0.006926,193,0.00562,194,0.001889,195,0.003523,196,0.001767,197,0.004807,198,0.007278,199,0.008945)\r\n'... '.backanno\r\n'... '.end\r\n']; fid = fopen(netlist, 'w+'); fprintf(fid,code); fid = fclose(fid); % % dos('LTSpice_call') % while exist('d:\Profile\a2679\Desktop\LTSpice\Test\Tandem_3T-series_1step.raw','file') == 0 % % end % pause (2) % dos('LTSpice_end') %