Path: news.mathworks.com!not-for-mail
From: "Ashish Uthama" <first.last@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab builder for excel - Optimization
Date: Fri, 17 Oct 2008 16:48:59 -0400
Organization: TMW
Lines: 66
Message-ID: <op.ui6r3xnra5ziv5@uthamaa.dhcp.mathworks.com>
References: <gdataq$ol6$1@fred.mathworks.com>
NNTP-Posting-Host: uthamaa.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1224276539 29426 172.31.57.126 (17 Oct 2008 20:48:59 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 17 Oct 2008 20:48:59 +0000 (UTC)
User-Agent: Opera Mail/9.60 (Win32)
Xref: news.mathworks.com comp.soft-sys.matlab:495900


How much more descriptive can the error message get?

> The error report says that the file 'final.m' is a script file and it  
> cannot be compiled with the present compiler.

The version of MATLAB you are using will not compile script files. You  
would have to convert all script files to function (just add a function  
final to the top to make it a function with no input/output args).

If your aim is to use the functionality of the following lines:
>      options = optimset('LargeScale','off');
>      [x, fval] = ...
>      fmincon(@objfun,x0,[],[],[],[],[],[],@confun,options)
where x0 is obtained from the Excel sheet. Convert this script to a  
function which has x0 as its input. Compile and deploy it as an Excel add  
in (follow the example in the doc) and then you can use a vector from the  
Excel sheet as the input x0.

Please find more details online at:
     http://www.mathworks.com/access/helpdesk/help/toolbox/matlabxl/ug/f2-7373.html
Or please paste this in the MATLAB command window:
     web([docroot,'/toolbox/matlabxl/ug/f2-7373.html'])



On Fri, 17 Oct 2008 16:42:02 -0400, Subrat Swain  
<swain.subrat01@gmail.com> wrote:

> Hi all,
> 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<=5.
>  Right now my M files are as follows;
>   Objective function file:
>      function f = objfun(x)
>      f = (x(1)*x(1)-2);
>   Constraint function file:
>      function [c, ceq] = confun(x)
>      c = [x(1)-5];
>      ceq = [];
>   Final script file (final.m)
>      x0 = [-1,1];
>      options = optimset('LargeScale','off');
>      [x, fval] = ...
>      fmincon(@objfun,x0,[],[],[],[],[],[],@confun,options)
>
> This is getting executed properly in MATLAB but when using MATLAB  
> Builder for creating COM files (.dll) I am getting an
> error mentioned below after providing above 3 .M files under the 'Add  
> files' tab of the MATLAB Builder.
>
>        'Error executing mcc, return status = 1'
> The error report says that the file 'final.m' is a script file and it  
> cannot be compiled with the present compiler.
> 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.
>   I will be highly obliged if any one can please help me out of this  
> problem. Expecting a quick reply from your side.
>
> Thanks and Regards,
> Subrat Kumar Swain.
>
>