Matlab automation server and Matlab Compiler Run Time
I did a simple excel macro which runs matlab functions sucessfully in a machine with Matlab installed.
Now I want to run it in a computer without matlab, with "MATLAB Compiler Run Time" installed. I can add the Matlb automation server type file (mlapp.tlb) sucessfully, but when I try to run it, I get this error:
"ActiveX component can't create object"
In this line:
Set matlab = New MLApp.MLApp
Do you know what is missing?
...Slow graphics rendering when GUI is compiled using the Matlab compiler
I have been trying to compile a GUI involving some sliderbars that
lets the user slide through images. When running under Matlab it runs
fine, but when compiled to a stand alone application there is
significant lag from when the user clicks the slider bars to when the
image is updated.
Non graphical processes seem to be running at the same speed.
Is this to be expected from the compiler or is there a potential fix?
...uint32 doesn't work in shared library which is compiled using matlab compiler mcc
please help me !
I am currently converting matlab code to c++ in MSVC 2010. however, the following matlab commands doesn't work.
so, I guessed face(2,:) might not be integer values. so, I added "face=int32(face)" line like this.
=> face=int32(face); <-- I guess int32 function doesn't work in a compiled library
save('printf101.txt', 'face', '-append', '-ascii'); <-- it doen't give any output
vertex(:,face(2,:)); <--- vertex and face array data received from c++ function
however, it doesn't work either the codes have worked well in matlab nevertheless.
the following is c++ code to pass variables to matlab c library including above codes.
vertex = mxCreateDoubleMatrix(vertexN, 3, mxREAL);
faces = mxCreateDoubleMatrix(faceN, 3, mxREAL);
scale_rat = mxCreateDoubleMatrix(1, 1, mxREAL);
double *temp_vertex = new double[vertexN*3];
double *temp_faces = new double[faceN*3];
// function calling matlab library generated by mcc command in Matlab
// mcc command: mcc -B csharedlib:clibcreate_features create_features.m ...
mlfCreate_features(2, &spins, &detectedPts, &locations, vertex, faces, scale_rat);
Is this a matlab bug ?? please let me know how I can solve this problem.
I have just found errors.
it was because of index number. Since index number in ma...Compile MATLAB
I have searched for a while trying to find an answer to this question. I have some MATLAB code in a .m file that I would like to compile to a dll and call from C#. Basically I want to be able to use my MATLAB code in C# without needing matlab installed on the computer. Is there any way to do this? I am using MATLAB r2008b.
As far as I know, you don't need matlab installed but you do NEED the matlab runtime environment.
"Kirk Robinson" <email@example.com> wrote in message <firstname.lastname@example.org>...
> I have searched for a while trying to find an answer to this question. I have some MATLAB code in a .m file that I would like to compile to a dll and call from C#. Basically I want to be able to use my MATLAB code in C# without needing matlab installed on the computer. Is there any way to do this? I am using MATLAB r2008b.
You need MATLAB and the compiler toolbox
if you want to compile code to run on another computer.
The target computer will need to install the MATLAB runtime library
but will not need the full blown MATLAB development environment.
So if I call MATLAB code using the MATLAB COM object I can just redistribute the runtime library with my application and it will run?
ImageAnalyst <email@example.com> wrote in message <firstname.lastname@example.org>...
> "Kirk Robinson&q...Error while using matlab compiler
Hello, I have the R2011a MATlab release, and while converting my code to a stand alone application using mcc, I get the following warnings:
Warning: an error occurred while parsing class uimgr.uiexplorer: Undefined function or method 'findclass' for input arguments of type 'double'.
In C:\Program Files\MATLAB\R2011a\toolbox\shared\spcuilib\@uimgr\@uiitem\schema.p>schema at 138 In C:\Program Files\MATLAB\R2011a\toolbox\shared\spcuilib\@uimgr\@uimenu\schema.p>schema at 12 Warning: an error occurred while parsing class uimgr.uiitem: Invalid data type. > In C:\Program Files\MATLAB\R2011a\toolbox\shared\spcuilib\@uimgr\@uimenu\schema.p>schema at 12 Warning: an error occurred while parsing class uimgr.uimenu: Invalid superclass handle.
My code does not take inputs, but it does call .m files as functions - which shouldn't be a problem because the gui of matlab compiler is quite simple, all I did was add the main calling file in the main file section and the called functions in the shared resources/helper files section.
What is the reason behind this error? the compiler successfully builds a .exe file but I don't get my output while running the application. My code uses the following toolboxes:
Computer vision toolbox
Neural network toolbox
I would be grateful if someone could help me out!
P.S - My program also calls saved variables in .mat files using the load function! Also could someone give me a link to ...Compile Fortran Code in Matlab
I have some Fortran code that I am trying to incorporate into MATLAB routines. This code has gotos, common blocks, etc... Is there a way to compile this code into a mex file? The file I'm interested in compiling has a bunch of subfunctions (no main program). My hope is to use these subfunctions as functions in MATLAB.
If this is not possible, do you have any suggestions for incorporating this code into MATLAB... or am I stuck rewriting it?
"Aaron" wrote in message <email@example.com>...
> I have some Fortran code that I am trying to incorporate into MATLAB routines. This code has gotos, common blocks, etc... Is there a way to compile this code into a mex file? The file I'm interested in compiling has a bunch of subfunctions (no main program). My hope is to use these subfunctions as functions in MATLAB.
> If this is not possible, do you have any suggestions for incorporating this code into MATLAB... or am I stuck rewriting it?
Yes, you can write a mex function interface to your Fortran code. Look at the doc under External Interfaces. There is also some sample code that ships with MATLAB. You will need your own Fortran compiler since MATLAB does not ship with one. You may also be interested in my Fortran 95 Interface code which can be found on the FEX here:
James Turs...matlab compile
I encountered strange output from compiled matlab file.
I compiled the below function (delete.m):
>> mcc -m delete.m
In the DOS, I do this:
out=4000 4900 4100
out=4000 4900 4100
However, those results are wrong. delete(10) should be 1000, and delete(1) shold be 100. Could you help what's the problem here?
"Young " <firstname.lastname@example.org> wrote in message
> Hi all
> I encountered strange output from compiled matlab file.
> I compiled the below function (delete.m):
> function [out]=delete(in)
>>> mcc -m delete.m
> In the DOS, I do this:
> C:\> delete(10)
> out=4000 4900 4100
> C:\> delete(1)
> out=4000 4900 4100
> However, those results are wrong. delete(10) should be 1000, and delete(1)
> shold be 100. Could you help what's the problem here?
You will need to convert the _string_ that is being passed into the compiled
application into a _numeric_ input before you work with it using arithmetic
operations. You probably also don't want to call your function delete; if
you're writing this as a "throwaway" test just to become familiar with how
MATLAB Compiler works, I'd call it foo.m or bar.m as those names do not ...Why can't Fortran-mex files be compiled on matlab V5.3 and run on matlab V6?
does anyone know why Fortran-mex files can't be compiled on matlab
V5.3 and run on matlab V6?
For example: if I compile the example-program (shipped with matlab)
on matlab version 5.3 (R11) and try to run
it on matlab version 6+ (R12 or R13), I get the error message:
"Unable to load mex file: E:\timestwo.dll. The specified module could
not be found.
??? Invalid MEX-file"
Likewise if I compile it on matlab version 6.1 (R12), I get a similar
error message if run on matlab version 5.3 (R11).
However, if I run it on matlab version 6.5 it works OK.
If I try the same experiment with the corresponding example file
written in C, timestwo.c, I get no such problems.
Why is that?
usually MEX-files need to be compiled with the MATLAB version you
want it later to run with. The reason is, that the code links against the
dynamic libraries (DLLs), which may change from version to version.
You may have luck that it works (see your example of timestwo.f),
but you should never rely on this.
"Per A. Brodtkorb" <Per.Brodtkorb@ffi.no> wrote in message
> does anyone know why Fortran-mex files can't be compiled on matlab
> V5.3 and run on matlab V6?
> For example: if I compile the example-program (shipped with matlab)
> on matlab version 5.3 (R11) and try to run
> it on matlab version 6+ (R12 or R13), I ...Shall i use the misrosoft Visual c++ code from a m-file generated from matlab in Visual C++ with out matlab runtime environment
...Does compilation with mcc speed up MATLAB code
I do not have access to the compiler module of MATLAB. I would like to understand if I have to expect big speed improvements in using it, or if the purpose of the compiler is more that, of being able to distribute a MATLAB application to non-MATLAB users, on a PC where MATLAB is not installed.
I understand that the answer may be application dependent, but I would appreciate just a general statement like the order of magnitude of typical speed improvements with the compiler.
Best regards and thanks to any answer.
"Claudio Pedrazzi" <email@example.com> wrote in message <firstname.lastname@example.org>...
> I do not have access to the compiler module of MATLAB. I would like to understand if I have to expect big speed improvements in using it, or if the purpose of the compiler is more that, of being able to distribute a MATLAB application to non-MATLAB users, on a PC where MATLAB is not installed.
> I understand that the answer may be application dependent, but I would appreciate just a general statement like the order of magnitude of typical speed improvements with the compiler.
There is no speed improvement what so ever, The so call "compiler" does nothing then packing your mfiles in different format and the MCR (Matlab Component Runtime) engine "interprets" it just like under Matlab environment.
"Claudio Pedrazzi" <email@example.com> wrote in messa...Matlab Compiler Code on Windows Embedded
Does anyone know weather it is possible to Matlab Compiler generated code on Windows Embedded ?
Applications or shared libraries created with the MATLAB Compiler or
Builders run on exactly the same platforms that MATLAB does. Since MATLAB
doesn't directly support Windows Embedded, I don't think you'll be able to
get your MATLAB Compiler-generated code to run there either.
You might have more luck with:
"Edwin " <firstname.lastname@example.org> wrote in message
> Does anyone know weather it is possible to Matlab Compiler generated code
> on Windows Embedded ?
...vector output using matlab compiler
I am trying to use matlab compiler to create a dll from a matlab function which outputs a vector and a structure.
Will these outputs cause a problem to the matlab compiler?
"adi cohen" <email@example.com> wrote in message
> I am trying to use matlab compiler to create a dll from a matlab function
> which outputs a vector and a structure. Will these outputs cause a problem
> to the matlab compiler?
Since you're calling this function (when compiled into a standalone
application) from the system prompt, where would you expect the outputs to
"live"? See the second bullet under "Using a MATLAB File You Plan to Deploy"
on this documentation page:
I would probably create a wrapper function that calls your function with two
outputs and saves them to a MAT-file (or writes them to some other file) and
compile both those functions so the wrapper is the "main" function.
Alternately you could check ISDEPLOYED in your function and save/write the
data to a file if ISDEPLOYED returns true.
To contact Technical Support use the Contact Us link on
thank you! this has been very helfpful!!!
I am trying to compile matlab file, using "deploytool" and/or "mcc" command.
The commands work fine and create .exe files successfully. But ,when I open the .exe file, I get an error "file_name.exe has stopped working."
I dont understand what is wrong. Please advise.
...'Matlab Code' to 'Embedded Matlab fun code'
I have a Matlab code to process a pure analog signal 'u'. Now I want to implement it in Simulink and I want to use it in 'Embedded Matlab fun block' so i need to transform 'Matlab code' to 'Embedded Matlab fun code' to perform the task.
The Matlab code is as follows:
u_abs = abs(u);
major_th = 1.5e-1;
minor_th = 1.8e-2;
major_peak_value = ;
minor_peak_value = ;
pos = 1;
pos_max = 1;
[m pos_max(end+1)] = max( u_abs( pos : pos + 10) );
pos_max(end) = pos_max(end) + pos - 1;
if m > major_th
major_peak_value(end+1) = m;
minor_peak_value(end+1) = m;
% exit the peak
pos = find(u_abs(pos:end) < minor_th, 1 , 'first') + pos-1;
% Find the beginning of the next peak
pos = find(u_abs(pos:end) > minor_th, 1 , 'first') + pos-1;
pos_max(2) = ;
plot(u); hold on;
I think i don't need this plot command as I will see the result in the scope directly.
Any suggestion will be very useful.
"Prashant Sandhi" wrote in message <firstname.lastname@example.org>...
> Dear friends,
> I have a Matlab code to process a pure analog signal 'u'. Now I want to implement it in Simu...code of matlab 7a not working in matlab 2009
I wrote a code in matlab 7a andand it was working over there
then i changed computer which was having matlab realease 2009a and it is not working
If i install Matlab 7 release 14, will my code work again thanks
"moonman" wrote in message <email@example.com>...
> I wrote a code in matlab 7a andand it was working over there
> then i changed computer which was having matlab realease 2009a and it is not working
> If i install Matlab 7 release 14, will my code work again thanks
Can you be more specific about the fact that your code is not working in 2009a but worked in 2007a? It would be helpful if you could narrow down what is not working in 2009a and provide error messages.
ok thanks wyne i will send error message after some hours
...Can we compile .m in .mex for use in matlab?
Since pcode does not compile subfunction.
Can we compile .m in .mex for use in matlab using Matlab Compiler?
Also, how can we integrate help header in the .p function?
...Which version of fortran compiler supported in Matlab 2011b
Which version of fortran compiler supported in Matlab 2011b.
Under windows 7, visual studio 2010.
"Renwen Lin" <firstname.lastname@example.org> wrote in message
> Which version of fortran compiler supported in Matlab 2011b.
> Under windows 7, visual studio 2010.
To contact Technical Support use the Contact Us link on
Thanks so much!
I have tried this:
Under windows 7 (64bit).
matlab 2011b (64 bit)
visual studio Microsoft Visual Studio 2010 (64 bit)
But it does not work, When I mex the examples in the Matlab command window, after "mex -setup".
"Steven_Lord" <email@example.com> wrote in message <firstname.lastname@example.org>...
> "Renwen Lin" <email@example.com> wrote in message
> > Which version of fortran compiler supported in Matlab 2011b.
> > Under windows 7, visual studio 2010.
> Steve Lord
> To contact Technical Support use the Contact Us link on
>> mex -v timestwo.f
Then I get:
-> Default options filename fo...Does Visual Studio compilers support student version MATLAB
Hello, my goal is make cuda code working at my MATLAB student version .I have 2010 Visual Studio with MATLAB Version(R2011a)
This is my VER
MATLAB Version 22.214.171.1245 (R2011a)
MATLAB License Number: STUDENT
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
MATLAB Version 7.12 (R2011a)
Simulink Version 7.7 (R2011a)
Control System Toolbox Version 9.1 (R2011a)
DSP System Toolbox Version 8.0 (R2011a)
Fixed-Point Toolbox Version 3.3 (R2011a)
Image Processing Toolbox Version 7.2 (R2011a)
Optimization Toolbox Version 6.0 (R2011a)
Parallel Computing Toolbox Version 5.1 (R2011a)
Signal Processing Toolbox Version 6.15 (R2011a)
Statistics Toolbox Version 7.5 (R2011a)
Symbolic Math Toolbox Version 5.6
Note that only Visual Studio compilers are supported.
Creating cudamexopts.bat based on ...slow optimization using nonlcon with GA within matlab toolbox and mixed integer problem using GA within Matlab
i'm using nonlcon(nonlinear inequality constraint) with GA from the toolbox provided by matlab. does anyone notice the extreme slowlness in evaluating nonlinear constraint as compared to other linear constraint?
my problem for nonlinear constraint is as follow
where x and y are Nx1 vector.
which means if N increases, the size of constraint increases.
and to clarify, the min problem is sometime like
where z=[x;y], which means x and y are some range of variable within z(just a matter of problem formulation)
well, is there anyone with other alternative or is it possible or method in including non-linear constraint directly to fitness function?
(well, actually nonlcon deals nonlinear constraint by using Augmented Lagrangian Pattern Search from what i see from the help file, or am i wrong?)
and one more question, is there anyone that attempt to attempt to apply mixed integer problem into the GA in matlab?
For now, i can only switch before pure integer or pure real number problem, but not mixed at the moment. I will be trying to add in some repair operator to fix up the variable that needs to be integer and other remaining in real number.
I'm not sure why you are using ga to solve your problem. Did you find
fmincon unsatisfactory in any way?
MATLAB mathematical toolbox documentation
On 5/10/2011 11:53 PM, terry wrote:
> greeting all,
> i'm using nonlcon(nonlinear inequality constraint)...compiling matlab .m / generating .c (c code) from .m
When I compile a matlab .m file (with mcc command), I get an
executable, that works well, and it also generates a C code (2 .c
files), and some other files (a .ctf, some .m files that do not have
matlab codes, but non readable codes, and others).
As I want to integrate the program with a C project, I don't want it
to be a black box, that I cant' debug. I tried to compile the .c files
in an external compiler, and it did not work. I tried in DevC++ and
also in Microsoft Visual C++. They show errors like "unexpected end of
file while looking for precompiled header directive", and I don't know
exactly what is missing. I was suspecting of #include "mclmcr.h", on
the .c files. I found some suggestions to change that to #include
"mclmcrrt.h", but it did not work. I found a mclmcr.h on the Matlab
folders, but it has other includes that I haven't found.
- Does anyone know if that .c files are usable or are only some
intermediate step while Matlab is building that exe?
- If I need those .h, how can I get them?
- Do I need to use that other files (other than those .c) generated
- If I am in the wrong way, what's the best way to get C files from .m
Thank you in advance.
renatoab <firstname.lastname@example.org> wrote in message <email@example.com>...
> Hi everyone,
> When I compile a matlab .m file (with mcc command), I get an
> exe...matlab 7.1 use matlab C++ math library
I wanna use matlab C++ math library into VC++6.0, but my matlab is 7.1. if i wanna use matlab C++ math library to programme, how can i setup my VC link?? why matlab7.1 doesn't have "extern->include->cpp" file???
In using matlab C++ math library , what difference between matlab 6.X and matlab7.1???
...Spawning matlab from within matlab
I would like to spawn multiple matlab processes from an '.m' script. Meaning, run an m-file from a 'parent' Matlab that launches, say, 8 more 'children' matlab processes. I'd like to do it in such a way that the same m-file in the 'parent' is able to close down, or kill, all the 'children' processes.
...Matlab engine with matlab R2010b
I'm working with an aplication that use the matlab engine. I made the C++ program and it is working well in my pc with matlab 2007b, but the same very basic program shows an error when I tried to compile it in a pc with matlab R2010b. The error is about the icuuc32.dll. ¿Why is asking this DLL? How can I solve this?. Thanks¡
...using gnumex and MATLABR2010b under windows for gfortran matlab cross compile
OS: Windows XP
MATLAB: MATLAB_R2010b or MATLAB_R2010a
Just wonder if anyone ever tried using gnumex for fortran+MATLAB cross compilation. I noticed that MATLAB supports Intel Visual Fortran 10/11 but I have not been able to get it working in MATLAB_R2010. (Note: The current mexopts folder in MATLAB is written using the linker in VS2005/VS2008, yet the intel trial is given using VS2010). So even I am sure I've got VS 2010 (full version) + intel visual fortran 11.1 (trial) installed, mex -setup was not able to detect the fortran complier.
I have then altered course to look into gnumex and wondering if anyone has ever tried cross-compiling fortran+MATLAB7 codes successfully with gnumex.