Path: news.mathworks.com!not-for-mail
From: "Ben Hinchliffe" <ben.hinchliffe@bluereference.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab builder for excel - Optimization
Date: Mon, 20 Oct 2008 20:46:02 +0000 (UTC)
Organization: Blue Reference, Inc.
Lines: 37
Message-ID: <gdiqma$7hr$1@fred.mathworks.com>
References: <gdataq$ol6$1@fred.mathworks.com>
Reply-To: "Ben Hinchliffe" <ben.hinchliffe@bluereference.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1224535562 7739 172.30.248.38 (20 Oct 2008 20:46:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 20 Oct 2008 20:46:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1498343
Xref: news.mathworks.com comp.soft-sys.matlab:496377


Hi Subrat,
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.  
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 "results documents" that contain textual, numerical, and graphical output of MATLAB commands. 
A free trial is available at www.InferenceForMATLAB.com. Hope this helps!
Best,
-Ben

"Subrat Swain" <swain.subrat01@gmail.com> wrote in message <gdataq$ol6$1@fred.mathworks.com>...
> 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.
>