Path: news.mathworks.com!not-for-mail
From: "Subrat Swain" <swain.subrat01@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Matlab builder for excel - Optimization
Date: Fri, 17 Oct 2008 20:42:02 +0000 (UTC)
Organization: Wayne State University
Lines: 29
Message-ID: <gdataq$ol6$1@fred.mathworks.com>
Reply-To: "Subrat Swain" <swain.subrat01@gmail.com>
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 1224276122 25254 172.30.248.35 (17 Oct 2008 20:42:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 17 Oct 2008 20:42:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1546283
Xref: news.mathworks.com comp.soft-sys.matlab:495899


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.