核心就是这一句ocnPrint(?output fout leafValue( getData(“/output” ?result “dc”)))
r_list = list(4000, 4100, 4200)
multi_list = list(20,21,22)
fout = outfile("/home/yourpath/results.txt" "w")
foreach(r_value r_list
foreach(multi_value multi_list
desVar( "r" r_value )
desVar( "multi" multi_value )
analysis('dc ?saveOppoint t ?param "temp" ?start "0"
?stop "100" ?step "10" )
run()
save( 'v "/output" )
fprintf(fout "multi %5.0f r_value %5.0f", multi_value*1.0, r_value*1.0)
ocnPrint(?output fout leafValue( getData("/output" ?result "dc")))
)
)
close(fout)
一个结果如下所示
multi 20 r_value 4000
temp © leafValue(getData()) (V)
0 439.268m
10 437.083m
20 434.987m
30 432.943m
40 430.945m
50 428.989m
60 427.07m
70 425.184m
80 423.325m
90 421.49m
100 419.672m
- ocean文档里的描述,如果直接使用"myfile"只有最后一次结果,定义fout = outfile(“/home/yourpath/results.txt” “w”)可以一直写入
If you provide a filename as the ?output argument, the ocnPrint command opens the file
and writes the information to it.
- ocean ref里面说getdata能和ocnprit配合使用,看一下电路看起来是封装symbol不能直接使用fprintf