|
Hi,
Sorry, I have not any experience with real time workshop and simulink.
A. Riazi
|
|
|
|
|
mcc -t -L C -W lib:imageprocessLib -T link:lib imageprocess.m libmmfile.mlib
Creating library imageprocessLib.lib and object imageprocessLib.exp
imageprocess.obj : error LNK2001: unresolved external symbol _mlfNEdge
imageprocess.obj : error LNK2001: unresolved external symbol _mlfRGB2GRAY
imageprocess.obj : error LNK2001: unresolved external symbol _mlfImwrite
imageprocess.obj : error LNK2001: unresolved external symbol _mlfNImread
imageprocessLib.dll : fatal error LNK1120: 4 unresolved externals
MBUILD.BAT: Error: Link of 'imageprocessLib.dll' failed.
----------------------------------matlab code-------------------
function imageprocess(x)
I1=imread(x);
imwrite(I1,'translated.png','png');
I2=imread('translated.png');
I=RGB2GRAY(I2);
BW=edge(I,'canny');
imwrite(BW,'filtered.jpg','jpg');
=================================================================
in fact, I want to make it as a stand-alone application, and rum mcc -p imageprocess to create a exe file. however, it can only make a translated png, the program compliants that "image/private/histc.dll" cannot be found. I have already included them, can anyone help me? thanks.
|
|
|
|
|
First try to compile Edge, RGB2GRAY, Imread and Imwrite functions to MEX-file (dll) then use the above command to compile your code. In this case you must add library of created MEX-files (those who have lib extension) to mcc command.
A. Riazi
|
|
|
|
|
if I only want to make a stand-alone application? I need a "exe" file which can be run independently without Matlab installed. Can you give me some suggestions?
|
|
|
|
|
|
I've tried to make tutorial described in this page (http://www.codeproject.com/dll/MatlabSharedLib.asp) but compiling with my Visual Studio 6.0 I've obtained this linking error:
>Linking...
>main.obj : error LNK2001: unresolved external symbol _mlfMLMeanfunction
>Debug/main.exe : fatal error LNK1120: 1 unresolved externals
>Error executing link.exe.
>
>main.exe - 2 error(s), 3 warning(s)
what can I resolve it ?!?
PS I've just set up MVS6 to include matlab libs and headers
|
|
|
|
|
Hi,
I have an application developed entirely in matlab which uses the image processing. signal processing and the neural network toolbox. Due to the presence of the 'sim' command which is not supported when converting matlab into stand alone exe using
mcc -m <filename>
i was unable to generate the exe.
But i have heard that there is a option by which we can compile some files to C and rest remain as .m files. Include them in a VC project and then convert into in an exe. Is it possible? If so will it run without matlab. Is it enough to have the run time libraries which can be obtained from "mginstaller.exe".
If above mentioned is possible it will be of great help if someone can forward me the steps to be followed in doing so.
thanks in advance
tins
|
|
|
|
|
Hello,
I use your technic to compile my own function from matlab into dll and use it in VC++6 for the SDK of Virtools .
But I have observed that the performance was inferior in VC++ than in MAthlab !
Made I a mistake ? If yes, where can it be done ?
Can you give me some tips to optimize Matlab Code and improve performance ?
Thanks
|
|
|
|
|
The documents of MATLAB compiler noticed some techniques to improve performance. For example in loops, if the counter is an scalar (not a martix or vector of type mxArray ), the speed of execution will improve very well. See MATLAB compiler documents for more information.
A. Riazi
|
|
|
|
|
I had the same problem with "formula" when I wanted to create a DLL for "fmincon". Now wondering whether I can ever use fmincon in a C application. If not, I have to look for a source code for constrained nonlinear optimization, yuck!
|
|
|
|
|
pls give some advice with converting pascal code to matlab or calling pascal file from matlab. because i want to write a data to paralel port (matlab6.1,win98). pls reply as soon as possible.
thank you.
|
|
|
|
|
There is no tool to convert turbo pascal files to MATLAB automatically. But if you know MATLAB very well you can do it by yourself!
A. Riazi
|
|
|
|
|
You can build your pascal code into a shared library and then, with the use of:
function somefunction; stdcall;
exports
somefunction;
in Delphi and then calling that function like:
#include "win.h"
FARPROC callback_f;
callback_f = GetProcAddress(GetModuleHandle(NULL), "somefunction");
callback_f();
you can use your Pascal code!
|
|
|
|
|
I download the demo project. It seems missing a <memory.h> file, but anyway,
there is no problem with building the executable.
But when I run the executable, a error message: " The procedure entr point mclValidateOutputError could not be located in
the dynamic link library libmatlb.dll"
could anyone help me with this? thank you and hug
xin
|
|
|
|
|
Sorry, but i think that no file is missing in the demo project.
And the executable work well on my computer.
So, perhaps working with matlab 6.5 will resolve your problem...but it's not sure. Try to buid the project on a another computer to see if it coms from your's....
|
|
|
|
|
Hello, I tried to compile the fmincon.m into DLL , but I failed. The following is
the error message, could you help me?
fmincon.m is a m-file supplied with optimization tool box
----------------------------------------------------------------------------------------------------------
> mcc -t -L C -W lib:fminconLib -T link:lib fmincon.m libmmfile.mlib
Warning: File: fmincon Line: 371 Column: 42
The MATLAB Compiler does not currently support MATLAB object-oriented programming. References to the method "formula" will produce a run-time error.
Warning: File: optim/private/diagnose Line: 179 Column: 22
The MATLAB Compiler does not currently support MATLAB object-oriented programming. References to the method "formula" will produce a run-time error.
Warning: File: optim/private/nlconst Line: 306 Column: 34
The MATLAB Compiler does not currently support MATLAB object-oriented programming. References to the method "formula" will produce a run-time error.
Creating library fminconLib.lib and object fminconLib.exp
fmincon.obj : error LNK2001: unresolved external symbol _mlfOptim_private_sfminle
fmincon.obj : error LNK2001: unresolved external symbol _mlfOptim_private_sfminbx
fmincon.obj : error LNK2001: unresolved external symbol _mlfOptim_private_nlconst
fmincon.obj : error LNK2001: unresolved external symbol _mlfOptim_private_diagnose
fmincon.obj : error LNK2001: unresolved external symbol _mlfOptim_private_startx
fmincon.obj : error LNK2001: unresolved external symbol _mlfOptim_private_optimfcnchk
fmincon.obj : error LNK2001: unresolved external symbol _mlfOptim_private_checkbounds
fminconLib.dll : fatal error LNK1120: 7 unresolved externals
MBUILD.BAT: Error: Link of 'fminconLib.dll' failed.
??? Error using ==> mbuild
Unable to complete successfully
??? Error: An error occurred while shelling out to mbuild (error code = 1).
Unable to build executable (specify the -v option for more information).
Error in ==> C:\MATLAB6p1\toolbox\compiler\mcc.dll
|
|
|
|
|
|
As is it said in the error message, the Matlab Compiler doesn't support object oriented programation.
In fact, your .m must called a matlab fonction which is objetc oriented so, it doesn't work.
You have re-write "formula" method.
Good Luck
|
|
|
|
|
Dear sir ,
I have suceesfully generate a dll file from a simple m-file ,however ,I faile to generate a dll file from a complex m-file ,which calls regress.m, Can you tell me how to generate a dll file?
following is my m-file:
function f=dd(x,y)
f=regress(y,x);
Thank you !!!!
|
|
|
|
|
What is the error? Is regress(y,x) MATLAB function, MEX file or ...?
A. Riazi
|
|
|
|
|
Dear sir ,
I have suceesfully generate a dll file from a simple m-file ,however ,I faile to generate a dll file from a complex m-file ,which calls regress.m, Can you tell me how to generate a dll file?
following is my m-file:
function f=dd(x,y)
f=regress(y,x);
|
|
|
|
|
I would like to know if there are a another syntax than the pointer syntax to access a element of a mxArray :
<br />
mxArray* M1;<br />
M1=mxCreateDoubleMatrix(M, N, mxREAL);<br />
M1=mxInit(parameter1,parameter2,...,parameterN);<br />
<br />
double* p;<br />
<br />
p=mxGetPr(M1);<br />
<br />
double element=p[i];
Thank
|
|
|
|
|
Hi,
at first i would like to thank A.Riazi for this article, which help me a lot in my work.
i wrote a C++ program using a DLL automatically generated by MATLAB from a custom .m function. It's work well but after several minutes, it comes a error Message from Windows "Lack of Virtual Memory".
In fact, my program is used every frame (around 20 time per second) in a another program (Virtools). I think that the loading/unloading of the library cause the lack of memory.
The problem is that I can not directly load/unloading the library in Virtools once for all...
How can I write my C++ code to prevent this problem ?
How can i do that according the fact that my program is executing each frame ? With a Boolean ?
------------------------------------------------
Self reponse :
I was wrong, the problem was comming from my use of pointers....Shame on me : the memory mangement by libInitialize() and libTerminate() wasn't my problem source
|
|
|
|
|
when i compiled project in vc++ 6.0
error C2065: 'mlfMeanFunction' : undeclared identifier
error C2440: '=' : cannot convert from 'int' to 'struct mxArray_tag *'
in file "MeanFunctionLib.c" have only
void MeanFunctionLibInitialize(void) {
mclLibInit(&_reference_count, &_lib_info);
}
void MeanFunctionLibTerminate(void) {
mclLibTerm(&_reference_count, &_lib_info);
}
but "MeanFunctionLib.h" have
extern mxArray * mlfMeanfunction(mxArray * x);
extern void MeanFunctionLibInitialize(void);
extern void MeanFunctionLibTerminate(void);
why ?
lady
|
|
|
|
|
I compiled the .m file containing the function "h = tf(b,a);" with the com builder. When I called the function from the shared dll, it shows a runtime error: Undefined function or variable "tf". Please give me some idea. Other things work well.
|
|
|
|