<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240269</link>
    <title>MATLAB Central Newsreader - MATLAB as ActiveX object</title>
    <description>Feed for thread: MATLAB as ActiveX object</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 02 Dec 2008 11:54:01 -0500</pubDate>
      <title>MATLAB as ActiveX object</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240269#614410</link>
      <author>Aleksey Komarov</author>
      <description>Please, help me to run some code in current MATLAB session, the following example on Visual Basic Script doesn't work:&lt;br&gt;
Dim MatLab&lt;br&gt;
Dim Result&lt;br&gt;
Set MatLab = Getobject(,&quot;Matlab.Application&quot;)&lt;br&gt;
Result = MatLab.Execute(&quot;surf(peaks)&quot;)&lt;br&gt;
Result = MatLab.Execute(&quot;a = [1 2 3 4; 5 6 7 8]&quot;)&lt;br&gt;
Result = MatLab.Execute(&quot;b = a + a &quot;)&lt;br&gt;
msgbox Result&lt;br&gt;
&lt;br&gt;
BUT the same code, which started new matlab kernel works fine:&lt;br&gt;
....&lt;br&gt;
Set MatLab = CreateObject(&quot;Matlab.Application&quot;)&lt;br&gt;
Result = MatLab.Execute(&quot;surf(peaks)&quot;)&lt;br&gt;
........&lt;br&gt;
&lt;br&gt;
Please help!!!</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 00:12:01 -0500</pubDate>
      <title>Re: MATLAB as ActiveX object</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240269#614613</link>
      <author>Ben Hinchliffe</author>
      <description>Hi Aleksey,&lt;br&gt;
I saw this same problem while developing a product called Inference for MATLAB (enables users to execute MATLAB files/code in Word &amp; Excel).  We didn't push hard for a workaround, but if you need a simple way to access the MATLAB API you can use Inference and access it through Word or Excel.  www.InferenceForMATLAB.com&lt;br&gt;
Good luck!&lt;br&gt;
-Ben&lt;br&gt;
&lt;br&gt;
&quot;Aleksey Komarov&quot; &amp;lt;abkomarov@gmail.com&amp;gt; wrote in message &amp;lt;gh37kp$5l3$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Please, help me to run some code in current MATLAB session, the following example on Visual Basic Script doesn't work:&lt;br&gt;
&amp;gt; Dim MatLab&lt;br&gt;
&amp;gt; Dim Result&lt;br&gt;
&amp;gt; Set MatLab = Getobject(,&quot;Matlab.Application&quot;)&lt;br&gt;
&amp;gt; Result = MatLab.Execute(&quot;surf(peaks)&quot;)&lt;br&gt;
&amp;gt; Result = MatLab.Execute(&quot;a = [1 2 3 4; 5 6 7 8]&quot;)&lt;br&gt;
&amp;gt; Result = MatLab.Execute(&quot;b = a + a &quot;)&lt;br&gt;
&amp;gt; msgbox Result&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; BUT the same code, which started new matlab kernel works fine:&lt;br&gt;
&amp;gt; ....&lt;br&gt;
&amp;gt; Set MatLab = CreateObject(&quot;Matlab.Application&quot;)&lt;br&gt;
&amp;gt; Result = MatLab.Execute(&quot;surf(peaks)&quot;)&lt;br&gt;
&amp;gt; ........&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Please help!!!</description>
    </item>
    <item>
      <pubDate>Sat, 06 Dec 2008 22:17:38 -0500</pubDate>
      <title>Re: MATLAB as ActiveX object</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240269#615474</link>
      <author>rtServo</author>
      <description>On Tue, 2 Dec 2008 11:54:01 +0000 (UTC), &quot;Aleksey Komarov&quot;&lt;br&gt;
&amp;lt;abkomarov@gmail.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;Please, help me to run some code in current MATLAB session, the following example on Visual Basic Script doesn't work:&lt;br&gt;
&amp;gt;Dim MatLab&lt;br&gt;
&amp;gt;Dim Result&lt;br&gt;
&amp;gt;Set MatLab = Getobject(,&quot;Matlab.Application&quot;)&lt;br&gt;
&amp;gt;Result = MatLab.Execute(&quot;surf(peaks)&quot;)&lt;br&gt;
&amp;gt;Result = MatLab.Execute(&quot;a = [1 2 3 4; 5 6 7 8]&quot;)&lt;br&gt;
&amp;gt;Result = MatLab.Execute(&quot;b = a + a &quot;)&lt;br&gt;
&amp;gt;msgbox Result&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;BUT the same code, which started new matlab kernel works fine:&lt;br&gt;
&amp;gt;....&lt;br&gt;
&amp;gt;Set MatLab = CreateObject(&quot;Matlab.Application&quot;)&lt;br&gt;
&amp;gt;Result = MatLab.Execute(&quot;surf(peaks)&quot;)&lt;br&gt;
&amp;gt;........&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;Please help!!!&lt;br&gt;
&lt;br&gt;
What worked for me was first to start Matlab with the /automation&lt;br&gt;
switch so that it acts as an ActiveX server.  Then I used:&lt;br&gt;
&lt;br&gt;
Set MatLab = GetObject(&quot;&quot;,&quot;Matlab.Application&quot;)&lt;br&gt;
&lt;br&gt;
Note that if the Matlab object goes out of scope, Matlab will close.&lt;br&gt;
&lt;br&gt;
-rt</description>
    </item>
  </channel>
</rss>

