'Reads an example from the current result set and adds the magnitude to the user-defined result set
Sub AddVoltageMagnitudeItem(taskname As String, probename As String)
Dim sourcefilebase As String
sourcefilebase = "Tasks\"+taskname+"\Components\"+probename+"\Data\"+probename+"\"
Dim tasktype As String
Dim dataname As String
Dim sXunit As String
Dim dXscale As double
With SimulationTask
.Reset
.Name(taskname)
tasktype = SimulationTask.GetTypeForTask(taskname)
sXunit = .GetUnit("Frequency")
dXscale = .GetUnitScale("Frequency")
If tasktype="AC" Then
dataname = "AC Voltage"
ElseIf tasktype="Spectral Lines" Then
dataname = "Voltage Spectral Lines"
End If
End With
Dim r1D As Object
Set r1D = Result1D(sourcefilebase+"a"+dataname)
With r1D
.Type ("Magnitude")
.Xlabel ("Frequency")
.Xunit (sXunit)
.Xscale (dXscale)
End With
r1D.AddToTree "Design\Results\"+probename+"\Mag("+dataname+") ["+taskname+"]"
End Sub