January 25th, 2006, 7:37 pm
Hint. I think you don't have to buy excel link to call matlab from excel. Example:Sub CallMatlab()' Dimension variables Dim MatLab As Object Dim ResultDim Invals(3, 4) As Double Dim MImag() As DoubleDim i, j As Integer ' Invoke Matlab Set MatLab = CreateObject("Matlab.Application") ' Read Invals from current spreadsheet ' (Assume Invals stored in B3:E5) For i = 0 To 2For j = 0 To 3Invals(i, j) = ActiveSheet.Range(Cells(i + 3, j + 2), Cells(i + 3, j + 2)).Value Next j Next i' Send Invals to Matlab Call MatLab.PutFullMatrix("a", "base", Invals, MImag) ' Send instructions to Matlab Result = MatLab.Execute("b=a.^2;") ' Retrieve Result Call MatLab.GetFullMatrix("b", "base", Invals, MImag) ' Store Result in B8:E10 ActiveSheet.Range("B8:E10").Value = Invals End Sub