Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here is an example of how to run the script. These three lines in output equations will create a data file of S(1,1) of AT31011_1v_1mA and AT31011_1v_1mA measurments and will create a new data file called "test" and put it there. Note that the third line is calling "mkdata2" function loaded in the Equation.bas script.

Image Modified

        Function mkdata2(data1() As Double, data2() As Double,dname As String) As Double
            'this function will be used to be able to set an x-axis for data calculated in the output equations
        
                'first check to see if data file is there
                Debug.Clear
                Dim dfiles As String
                x = Project.DataFiles.Count
                For i = 1 To x
                        If (dname = Project.DataFiles(i).Name) Then
                                Project.DataFiles.Remove(i)
                        End If
                Next i
            len1 = UBound(data1)
            len2 = UBound(data2)
            If (len2 <> len1) Then
                        MsgBox("vectors not the same length")
                        Debug.Print "vectors not the same length"
                        mkdata2 = -1
                        Exit Function
            End If
            tmpname$="__awr$$$.txt"
            Open  tmpname$ For Output As #1
            For i = 0 To len1
                        Print #1,data1(i);" ";data2(i)
            Next i
            Close #1
                Dim df As DataFile
            Set df = Project.DataFiles.Add(dname,tmpname$,True,mwDFT_TXT)
                mkdata2 = 1
        
        End Function
        Function mkdata3(data1() As Double, data2() As Double,data3() As Double,dname As String) As Double
            'this function will be used to be able to set an x-axis for data calculated in the output equations
        
                'first check to see if data file is there
                Debug.Clear
                Dim dfiles As String
                x = Project.DataFiles.Count
                For i = 1 To x
                        If (dname = Project.DataFiles(i).Name) Then
                                Project.DataFiles.Remove(i)
                        End If
                Next i
            len1 = UBound(data1)
            len2 = UBound(data2)
            len3 = UBound(data3)
            If (len2 <> len1) Then
                        MsgBox("vectors not the same length")
                        Debug.Print "vectors not the same length"
                        mkdata3 = -1
                        Exit Function
            End If
            If (Len3 <> len1) Then
                        MsgBox("vectors not the same length")
                        Debug.Print "vectors not the same length"
                        mkdata3 = -1
                        Exit Function
            End If
            tmpname$="__awr$$$.txt"
            Open  tmpname$ For Output As #1
            For i = 0 To len1
                        Print #1,data1(i);" ";data2(i);" ";data3(i)
            Next i
            Close #1
                Dim df As DataFile
            Set df = Project.DataFiles.Add(dname,tmpname$,True,mwDFT_TXT)
                mkdata3= 1
        End Function