|
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.
|
|
|
|
|
The first step is compiling MATLAB tf function. After doing that (now you have a dll, a library file and one header file) you can import it to your project. The MATLAB tf function converted to mlftf in C.
A. Riazi
|
|
|
|
|
when i use mcc -t -L cpp instead of mcc -t -L c I get a lot of errors. What can I do?
Thanks a lot
|
|
|
|
|
Why you want to use that syntax. There is no reason to use it, because it compiled and we can use it in VC without any problem using MATLAB C API or C++ library!
A. Riazi
|
|
|
|
|
Hi, I'm working with C++ Builder 5.0 and I copied the example into an "On Button Click" event. When I compile the program everything seems to be OK, but when the program is going to run the CPU window appears (with assembler code, registry status, etc).
I would preciate if someone helps me with this problem.
Thank's
|
|
|
|
|
When I perform this example is shown an error dialog, when it tries load the library, complaining about the entry point to procedure ut_initialize_keydata_table in dynamic link library libut.dll can't be found.
What would be wrong in my environment ? I'm using VC++6.
Thank's
|
|
|
|
|
What is version of your MATLAB? Did you install MATLAB C/C++ Math Library?
A. Riazi
|
|
|
|
|
I have the MatLab version 6 (release 12) with C/C++ Math Library installed.
Eggo Pinheiro.
|
|
|
|
|
I tried to include the matlab header and got this error,what do u make of it??
c:\matlab6p5\extern\include\libmmfile.h(1650) : error C2143: syntax error : missing ')' before 'constant'
c:\matlab6p5\extern\include\libmmfile.h(1650) : error C2143: syntax error : missing ';' before 'constant'
c:\matlab6p5\extern\include\libmmfile.h(1650) : fatal error C1004: unexpected end of file found
|
|
|
|
|
Paste your code that I can help you.
A. Riazi
|
|
|
|
|
|
you->too( );
|
|
|
|