Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: MATLAB as ActiveX object
Date: Tue, 2 Dec 2008 11:54:01 +0000 (UTC)
Organization: Softline Company
Lines: 17
Message-ID: <gh37kp$5l3$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228218841 5795 172.30.248.35 (2 Dec 2008 11:54:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 2 Dec 2008 11:54:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1301174
Xref: news.mathworks.com comp.soft-sys.matlab:504340


Please, help me to run some code in current MATLAB session, the following example on Visual Basic Script doesn't work:
Dim MatLab
Dim Result
Set MatLab = Getobject(,"Matlab.Application")
Result = MatLab.Execute("surf(peaks)")
Result = MatLab.Execute("a = [1 2 3 4; 5 6 7 8]")
Result = MatLab.Execute("b = a + a ")
msgbox Result

BUT the same code, which started new matlab kernel works fine:
....
Set MatLab = CreateObject("Matlab.Application")
Result = MatLab.Execute("surf(peaks)")
........

Please help!!!