<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165562</link>
    <title>MATLAB Central Newsreader - Sample Matlab Engine Doesn't Work?</title>
    <description>Feed for thread: Sample Matlab Engine Doesn't Work?</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>Wed, 12 Mar 2008 21:39:05 -0400</pubDate>
      <title>Sample Matlab Engine Doesn't Work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165562#420573</link>
      <author>David Doria</author>
      <description>I tried this in c++, but it produces a blank plot!  I linked&lt;br&gt;
to libmx.lib libmex.lib libeng.lib.&lt;br&gt;
&lt;br&gt;
Seems very odd, it is clearly almost working because it is&lt;br&gt;
producing a plot, but there is nothing on it!!&lt;br&gt;
Any thoughts?&lt;br&gt;
&lt;br&gt;
int main()&lt;br&gt;
{&lt;br&gt;
	Engine *ep;&lt;br&gt;
	&lt;br&gt;
	if (!(ep = engOpen(&quot;\0&quot;))) {&lt;br&gt;
		fprintf(stderr, &quot;\nCan't start MATLAB engine\n&quot;);&lt;br&gt;
		Pause();&lt;br&gt;
		return EXIT_FAILURE;&lt;br&gt;
	}&lt;br&gt;
	engEvalString(ep, &quot;x = 1:1:10);&quot;);&lt;br&gt;
	engEvalString(ep, &quot;y = x.^2;&quot;);&lt;br&gt;
	engEvalString(ep, &quot;plot(x,y);&quot;);&lt;br&gt;
	engEvalString(ep, &quot;title('Test');&quot;);&lt;br&gt;
	Pause();&lt;br&gt;
&lt;br&gt;
	//Free memory, close MATLAB engine.&lt;br&gt;
	engEvalString(ep, &quot;close;&quot;);</description>
    </item>
    <item>
      <pubDate>Thu, 13 Mar 2008 06:37:18 -0400</pubDate>
      <title>Re: Sample Matlab Engine Doesn't Work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165562#420626</link>
      <author>James Tursa</author>
      <description>On Wed, 12 Mar 2008 21:39:05 +0000 (UTC), &quot;David Doria&quot;&lt;br&gt;
&amp;lt;daviddoria@gmail.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt;	engEvalString(ep, &quot;x = 1:1:10);&quot;);&lt;br&gt;
&lt;br&gt;
Typo, extra paren, this should be:&lt;br&gt;
&lt;br&gt;
	engEvalString(ep, &quot;x = 1:1:10;&quot;);&lt;br&gt;
&lt;br&gt;
The problem with using engEvalString is you don't get any feedback&lt;br&gt;
that your string is invalid. There is a heavy burdon on the programmer&lt;br&gt;
to examine the string carefully to make sure it is valid syntax, the&lt;br&gt;
variables used are in existence, names are spelled correctly, etc.&lt;br&gt;
etc. etc. It is good practice to copy &amp; paste these strings into the&lt;br&gt;
MATLAB workspace one by one to see that they do in fact work as&lt;br&gt;
expected. This avoids wasting time trying to track down a non-existent&lt;br&gt;
coding error in the C++ code itself.&lt;br&gt;
&lt;br&gt;
James Tursa</description>
    </item>
    <item>
      <pubDate>Thu, 13 Mar 2008 11:59:01 -0400</pubDate>
      <title>Re: Sample Matlab Engine Doesn't Work?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165562#420651</link>
      <author>David Doria</author>
      <description>Oh man! Really sorry for the dumb mistake. I guess it's good&lt;br&gt;
to know that is the case for the future when my commands are&lt;br&gt;
more than 10 characters hahaha.&lt;br&gt;
&lt;br&gt;
Thanks for the help.&lt;br&gt;
&lt;br&gt;
David&lt;br&gt;
&lt;br&gt;
James Tursa &amp;lt;aclassyguywithaknotac@hotmail.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;64iht3dv5ou8htupbb01sr7t3majehnhju@4ax.com&amp;gt;...&lt;br&gt;
&amp;gt; On Wed, 12 Mar 2008 21:39:05 +0000 (UTC), &quot;David Doria&quot;&lt;br&gt;
&amp;gt; &amp;lt;daviddoria@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;	engEvalString(ep, &quot;x = 1:1:10);&quot;);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Typo, extra paren, this should be:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 	engEvalString(ep, &quot;x = 1:1:10;&quot;);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The problem with using engEvalString is you don't get any&lt;br&gt;
feedback&lt;br&gt;
&amp;gt; that your string is invalid. There is a heavy burdon on&lt;br&gt;
the programmer&lt;br&gt;
&amp;gt; to examine the string carefully to make sure it is valid&lt;br&gt;
syntax, the&lt;br&gt;
&amp;gt; variables used are in existence, names are spelled&lt;br&gt;
correctly, etc.&lt;br&gt;
&amp;gt; etc. etc. It is good practice to copy &amp; paste these&lt;br&gt;
strings into the&lt;br&gt;
&amp;gt; MATLAB workspace one by one to see that they do in fact&lt;br&gt;
work as&lt;br&gt;
&amp;gt; expected. This avoids wasting time trying to track down a&lt;br&gt;
non-existent&lt;br&gt;
&amp;gt; coding error in the C++ code itself.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; James Tursa</description>
    </item>
  </channel>
</rss>

