Sending data to MatLab using PutWorkspaceData
이전 댓글 표시
I am having trouble getting the correct syntax for passing data into MatLab using Excel/VBA.
I have copied the example from the help document http://www.mathworks.com/help/techdoc/ref/putworkspacedata.html but receive the following error:
Dim Matlab As Object
Dim data(6) As Double
Dim i As Integer
MatLab = CreateObject("matlab.application")
For i = 0 To 6
data(i) = i * 15
Next i
MatLab.PutWorkspaceData("A","base",data)
MsgBox("In MATLAB, type" & vbCrLf & "A")
"Compile Error: Syntax Error" around the following line of code:
Matlab.PutWorkspaceData("A", "base", data)
What is the correct syntax for this call?
Thank You, Craig
PS. I'm using Excel 2007 with VB 6.5 and Matlab R2010a
채택된 답변
추가 답변 (1개)
Sean de Wolski
2011년 12월 20일
Try single quotes:
Matlab.PutWorkspaceData('A', 'base', data)
MATLAB uses single quotes to denote strings.
댓글 수: 2
Craig
2011년 12월 20일
Dushyant Dhundara
2016년 5월 29일
Hi, I am trying to mimic your code but for C#. it almost works, but in matlab it window when I type A, it only outputs the very last value. Did that happen with you ?
카테고리
도움말 센터 및 File Exchange에서 Write COM Applications to Work with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!