MatLab Automation Server Functions and Properties Feval("load", ...)
Mostrar comentarios más antiguos
I am having problems loading a Matlab workspace in VBA - the error I get is that the call to load cannot find "MatLab.mat" which makes no sense as I have provided the filename "reduce_to_common_factors.mat".
Here is my code down to the line which fails:
{Dim m_MatlabApp As Object
Set m_MatlabApp = CreateObject("Matlab.Application")
Dim wkbk As Workbook
Dim wksht As Worksheet
Dim ndim As Integer: ndim = 30
Dim itsdim As Variant
ReDim rho_matrix(1 To ndim, 1 To ndim) As Double
ReDim output(1 To ndim, 1 To ndim) As Double
ReDim my_output_real(1 To ndim, 1 To ndim) As Double, my_output_imag(1 To ndim, 1 To ndim) As Double
Dim image() As Double, my_bool As Boolean, Result As String
Set wkbk = Workbooks("Evaluate_LPI_Swap_30y_With_Smile.xlsx")
Set wksht = wkbk.Worksheets("Modelling_LPI")
Dim cnt_row As Integer, cnt_col As Integer, retVal As Variant
wksht.Activate
'Load the Excel correlation matrix into a double array
For cnt_row = 1 To ndim
For cnt_col = 1 To ndim
rho_matrix(cnt_row, cnt_col) = wksht.Cells(5 + cnt_row, 4 + cnt_col).Value
output(cnt_row, cnt_col) = 0
Next cnt_col
Next cnt_row
'update the workspace variables in MatLab
Result = m_MatlabApp.Execute("cd Q:\Team\Russell_Bickerton\MatLab\Data")
retVal = m_MatlabApp.Feval("load", 0, "reduce_to_common_factors.mat")}
The help topic for this function call is MatLAB, Functions, External Interfaces, MATLAB COM Automation Server Support, MatLAB Automation Server Functions and Properties.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Write COM Applications to Work with MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!