<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237725</link>
    <title>MATLAB Central Newsreader - Matlab builder for excel - Optimization</title>
    <description>Feed for thread: Matlab builder for excel - Optimization</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>Fri, 17 Oct 2008 20:42:02 -0400</pubDate>
      <title>Matlab builder for excel - Optimization</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237725#605980</link>
      <author>Subrat Swain</author>
      <description>Hi all,&lt;br&gt;
I am facing a problem while compiling my .M files in Matlab builder for excel. I am having M files in Matlab which I want to export it to Excel VBA and create a VBA code which will help me in doing computation in excel.This is a simple Optimization problem with objective function as = X^2-2 and I have to maximize it. My constraints are X&amp;lt;=5. &lt;br&gt;
&amp;nbsp;Right now my M files are as follows;&lt;br&gt;
&amp;nbsp;&amp;nbsp;Objective function file:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function f = objfun(x)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;f = (x(1)*x(1)-2);&lt;br&gt;
&amp;nbsp;&amp;nbsp;Constraint function file:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function [c, ceq] = confun(x)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;c = [x(1)-5];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ceq = [];&lt;br&gt;
&amp;nbsp;&amp;nbsp;Final script file (final.m)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x0 = [-1,1];&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;options = optimset('LargeScale','off');&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[x, fval] = ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fmincon(@objfun,x0,[],[],[],[],[],[],@confun,options)&lt;br&gt;
&lt;br&gt;
This is getting executed properly in MATLAB but when using MATLAB Builder for creating COM files (.dll) I am getting an&lt;br&gt;
error mentioned below after providing above 3 .M files under the 'Add files' tab of the MATLAB Builder. &lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Error executing mcc, return status = 1'&lt;br&gt;
The error report says that the file 'final.m' is a script file and it cannot be compiled with the present compiler. &lt;br&gt;
But when I tried to execute it in the system having Microsoft Visual C/C++ version 6.5 compiler still I am facing the same error. &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;I will be highly obliged if any one can please help me out of this problem. Expecting a quick reply from your side.&lt;br&gt;
&lt;br&gt;
Thanks and Regards,&lt;br&gt;
Subrat Kumar Swain.</description>
    </item>
    <item>
      <pubDate>Fri, 17 Oct 2008 20:48:59 -0400</pubDate>
      <title>Re: Matlab builder for excel - Optimization</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237725#605981</link>
      <author>Ashish Uthama</author>
      <description>How much more descriptive can the error message get?&lt;br&gt;
&lt;br&gt;
&amp;gt; The error report says that the file 'final.m' is a script file and it  &lt;br&gt;
&amp;gt; cannot be compiled with the present compiler.&lt;br&gt;
&lt;br&gt;
The version of MATLAB you are using will not compile script files. You  &lt;br&gt;
would have to convert all script files to function (just add a function  &lt;br&gt;
final to the top to make it a function with no input/output args).&lt;br&gt;
&lt;br&gt;
If your aim is to use the functionality of the following lines:&lt;br&gt;
&amp;gt;      options = optimset('LargeScale','off');&lt;br&gt;
&amp;gt;      [x, fval] = ...&lt;br&gt;
&amp;gt;      fmincon(@objfun,x0,[],[],[],[],[],[],@confun,options)&lt;br&gt;
where x0 is obtained from the Excel sheet. Convert this script to a  &lt;br&gt;
function which has x0 as its input. Compile and deploy it as an Excel add  &lt;br&gt;
in (follow the example in the doc) and then you can use a vector from the  &lt;br&gt;
Excel sheet as the input x0.&lt;br&gt;
&lt;br&gt;
Please find more details online at:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/toolbox/matlabxl/ug/f2-7373.html&quot;&gt;http://www.mathworks.com/access/helpdesk/help/toolbox/matlabxl/ug/f2-7373.html&lt;/a&gt;&lt;br&gt;
Or please paste this in the MATLAB command window:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;web([docroot,'/toolbox/matlabxl/ug/f2-7373.html'])&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
On Fri, 17 Oct 2008 16:42:02 -0400, Subrat Swain  &lt;br&gt;
&amp;lt;swain.subrat01@gmail.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; I am facing a problem while compiling my .M files in Matlab builder for  &lt;br&gt;
&amp;gt; excel. I am having M files in Matlab which I want to export it to Excel  &lt;br&gt;
&amp;gt; VBA and create a VBA code which will help me in doing computation in  &lt;br&gt;
&amp;gt; excel.This is a simple Optimization problem with objective function as =  &lt;br&gt;
&amp;gt; X^2-2 and I have to maximize it. My constraints are X&amp;lt;=5.&lt;br&gt;
&amp;gt;  Right now my M files are as follows;&lt;br&gt;
&amp;gt;   Objective function file:&lt;br&gt;
&amp;gt;      function f = objfun(x)&lt;br&gt;
&amp;gt;      f = (x(1)*x(1)-2);&lt;br&gt;
&amp;gt;   Constraint function file:&lt;br&gt;
&amp;gt;      function [c, ceq] = confun(x)&lt;br&gt;
&amp;gt;      c = [x(1)-5];&lt;br&gt;
&amp;gt;      ceq = [];&lt;br&gt;
&amp;gt;   Final script file (final.m)&lt;br&gt;
&amp;gt;      x0 = [-1,1];&lt;br&gt;
&amp;gt;      options = optimset('LargeScale','off');&lt;br&gt;
&amp;gt;      [x, fval] = ...&lt;br&gt;
&amp;gt;      fmincon(@objfun,x0,[],[],[],[],[],[],@confun,options)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This is getting executed properly in MATLAB but when using MATLAB  &lt;br&gt;
&amp;gt; Builder for creating COM files (.dll) I am getting an&lt;br&gt;
&amp;gt; error mentioned below after providing above 3 .M files under the 'Add  &lt;br&gt;
&amp;gt; files' tab of the MATLAB Builder.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;        'Error executing mcc, return status = 1'&lt;br&gt;
&amp;gt; The error report says that the file 'final.m' is a script file and it  &lt;br&gt;
&amp;gt; cannot be compiled with the present compiler.&lt;br&gt;
&amp;gt; But when I tried to execute it in the system having Microsoft Visual  &lt;br&gt;
&amp;gt; C/C++ version 6.5 compiler still I am facing the same error.&lt;br&gt;
&amp;gt;   I will be highly obliged if any one can please help me out of this  &lt;br&gt;
&amp;gt; problem. Expecting a quick reply from your side.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks and Regards,&lt;br&gt;
&amp;gt; Subrat Kumar Swain.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;</description>
    </item>
    <item>
      <pubDate>Mon, 20 Oct 2008 20:46:02 -0400</pubDate>
      <title>Re: Matlab builder for excel - Optimization</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/237725#606458</link>
      <author>Ben Hinchliffe</author>
      <description>Hi Subrat,&lt;br&gt;
I'm not sure why you're getting the error, but you may be able to avoid this problem by using Inference for MATLAB to execute MATLAB files/objects/commands directly in MS Excel and Word.  &lt;br&gt;
You don't have to know the Office object model (VBA)- Inference for MATLAB works as an add-in for Office, allowing users to combine MATLAB objects, MATLAB script/commands, data, and text annotations(commentary) in Excel and Word documents.  These documents can be executed to produce &quot;results documents&quot; that contain textual, numerical, and graphical output of MATLAB commands. &lt;br&gt;
A free trial is available at www.InferenceForMATLAB.com. Hope this helps!&lt;br&gt;
Best,&lt;br&gt;
-Ben&lt;br&gt;
&lt;br&gt;
&quot;Subrat Swain&quot; &amp;lt;swain.subrat01@gmail.com&amp;gt; wrote in message &amp;lt;gdataq$ol6$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; I am facing a problem while compiling my .M files in Matlab builder for excel. I am having M files in Matlab which I want to export it to Excel VBA and create a VBA code which will help me in doing computation in excel.This is a simple Optimization problem with objective function as = X^2-2 and I have to maximize it. My constraints are X&amp;lt;=5. &lt;br&gt;
&amp;gt;  Right now my M files are as follows;&lt;br&gt;
&amp;gt;   Objective function file:&lt;br&gt;
&amp;gt;      function f = objfun(x)&lt;br&gt;
&amp;gt;      f = (x(1)*x(1)-2);&lt;br&gt;
&amp;gt;   Constraint function file:&lt;br&gt;
&amp;gt;      function [c, ceq] = confun(x)&lt;br&gt;
&amp;gt;      c = [x(1)-5];&lt;br&gt;
&amp;gt;      ceq = [];&lt;br&gt;
&amp;gt;   Final script file (final.m)&lt;br&gt;
&amp;gt;      x0 = [-1,1];&lt;br&gt;
&amp;gt;      options = optimset('LargeScale','off');&lt;br&gt;
&amp;gt;      [x, fval] = ...&lt;br&gt;
&amp;gt;      fmincon(@objfun,x0,[],[],[],[],[],[],@confun,options)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This is getting executed properly in MATLAB but when using MATLAB Builder for creating COM files (.dll) I am getting an&lt;br&gt;
&amp;gt; error mentioned below after providing above 3 .M files under the 'Add files' tab of the MATLAB Builder. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;        'Error executing mcc, return status = 1'&lt;br&gt;
&amp;gt; The error report says that the file 'final.m' is a script file and it cannot be compiled with the present compiler. &lt;br&gt;
&amp;gt; But when I tried to execute it in the system having Microsoft Visual C/C++ version 6.5 compiler still I am facing the same error. &lt;br&gt;
&amp;gt;     &lt;br&gt;
&amp;gt;    I will be highly obliged if any one can please help me out of this problem. Expecting a quick reply from your side.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks and Regards,&lt;br&gt;
&amp;gt; Subrat Kumar Swain.&lt;br&gt;
&amp;gt; </description>
    </item>
  </channel>
</rss>

