
Comments and Discussions





Is that what the MEX file all about?
I am doing a project in fingerprint identification system to be implemented on an FPGA platform.I have made the matlab code but unfortunately the FPGA software requires the functions to be in C or c++.






Hi,
I've used a function from matlab library (normrand) in order to generate random numbers with normal distribution. Now I'm going to use such function in my program which is in Visual C#. How could I do this?
Is it correct to create a .dll file with c++ compiler and then use ".net framework" procedures to use a C code in my C# program?
In fact creating a .dll file from a matlab .m file is not still clear for me?
Is there anybody who could help me?
Thanks for your cooperation





There is a code available on the site "http://www.codeproject.com/KB/cpp/mexFunction.aspx"
Please tell me how to run that code. And where to save those files in detail...
You can contact me at linda_mgnl@hotmail.com
Waiting for your reply..





Dear Rizvi and all Reviewers,
I am Ajay Dashora (email: ajaydashora@gmail.com).
I am using MATLAB (version 2009b) and trying to convert a MATLAB user defined function (first.m) to a C shared library (dll) so as to use it in one of the C code in as a function call. Further, the funtion "first.m" calls two other user defined functions ("second.m" and "third.m") with some user defined library function ("one.m" and "two.m"). I have following quarries regarding the conversion of this MATLAB code to C shared library:
1) I am using following command to createa a dll (libFirst.dll) and afterwards I want to compile this created lib file with c code using mbuild. Following command is appropriate:
mcc t L C W lib:libFirst T link:lib h first.m libmmfile.mlib
2) Should I create the dll through mcc command for only "first.m" or should I generate the dll by mentioning all "user defined structured functions" on command line? Please note that I will not use the created code second.c and third.c in any program. Please advice...
3) Further, how should I treat the "user defined library functions" for creating the dll and later compilation? Please advice...
4) After creating the dll, I want to call this 'function' in C code. The C code address the input argument vector by 'indv' for evaluating the function. How should I define the variable 'x', which is an array, in the main function of C code for evaluating this "Function"? Please advice....
5) One of the "user defined function" which is important for calculating the "Function" read the value of some data from Excel Sheet (using xlsread). How can I use the xlsread command in External Interfaces? Do I need a additional treatment of this, for successfully calling the "MATLAB written Function" in C code? Please advice...
Request your assistance for this issue.
In anticipation of an early reply from you, I remain...
Best Regards,
Ajay





AssalamoAlikum bro, I am working on matlab and want to convert the mfile into a .exe format so that i can write it onto a microcontroller and run it. Please help me............





Asalamulaikum
I need a project that is based on neural networks using any program ( matlab, c++, prolog, n etc).
If you could be of any help i will be very grateful. please.
I'm on a dead line with my projects date. I know I've said on such a short notice but a project on neural networks is hard to find which has not been uploaded on the internet. Kindly help me in this regard please.
Thankyou!
I will be waiting for you response. email : sameenhkhan@hotmail.com
Sameen





Hi I having some problems with the mex stuff. Im working on a c++ project, which uses the boost libraries, so im including files like the following: #include <boost/numeric/ublas/vector.hpp> But when I try to compile it from matlab, it doesnt work I tried: mex mexi.cpp L/boostlib/boost/numeric/ublas lvector.hpp and a dozen other similar stuff. Id really be thankful, if smbody could help me, I gotta find this out for my project work and have no clue. Thanks so much Nisha K





Can U please tell me the link from which
I can download
"MCC  MATLAB to C/C++ compiler" ?
Regards,
Arun Kumar.A





i need help to make a network to predict geomagnetic field using the Gufm1model





Hi.
I want to create mex file (.mexw32) from .m file in Matlab 7.1.
It seems that it is no longer supported. I used to call
mcc x in Matlab 6.5.1 to generate .dll files that i can run
in Matlab. How do I do that in 7.1? Thanks for the help.





hi
I appreciate your effort very much.
when I compile a mex file in matlab, it could not find all the headers files (.h) needes ... I always have a massege of type " Can not includ ....h file) , althought the h file is placed in the include directory in matlab root .. and in the current directory
would you please help me?
best regards
Majd





Hi everybody!
I try to compile the following myfile.c file with the mex functionality of Matlab but it does not work.I get the message:
Mex file entry point is missing. Please check the (casesensitive)
spelling of mexFunction (for C MEXfiles), or the (caseinsensitive)
spelling of MEXFUNCTION (for FORTRAN MEXfiles). ??? Invalid MEXfile 'C:\MATLAB71\extern\myfile.mexw32': The specified module could not be found.
How should I write a mexfunction in the .C code?
The file myfile.c (performs a statistical test) is the following:
 myfile.c 
#include
#include
#include
#define max(a,b) a>b?a:b
double T2,*h;
//returns T2 statistics
void redun(double *x, double *y, int N, int m, int mmax, double
epsilon)
{
int i, j, s;
int IYij, IXYij, IYZij, IXYZij;
double disx, disy, disz, *Cy, *Cxy, *Cyz, *Cxyz, mu;
mu=pow(2.0*epsilon,m+2*mmax+1);
Cy = (double *) malloc(N*sizeof(double));
Cxy = (double *) malloc(N*sizeof(double));
Cyz = (double *) malloc(N*sizeof(double));
Cxyz = (double *) malloc(N*sizeof(double));
for (i=0;i!=N;i++)
h[i] = Cy[i] = Cxy[i] = Cyz[i] = Cxyz[i] = 0.0;
T2=0.0;
for (i=mmax;i!=N;i++)
{
Cy[i]=Cxy[i]=Cyz[i]=Cxyz[i]=0.0;
for (j=mmax;j!=N;j++)
if (j!=i)
{
disx = disy = 0.0;
for (s=1;s!=m+1;s++)
disx = max(fabs(x[is]x[js]),disx);
for (s=1;s!=mmax+1;s++)
disy = max(fabs(y[is]y[js]),disy);
if (disy <= epsilon)
{
Cy[i]++;
if (disx <= epsilon)
{
Cxy[i]++;
}
disz = max(fabs(y[i]y[j]),disy);
if (disz <= epsilon)
{
Cyz[i]++;
if (disx <= epsilon)
{
Cxyz[i]++;
}
}
} // end condition Yi  Yj < epsilon
} // end loop over j
Cy[i] /= (double)(Nmmax);
Cxy[i] /= (double)(Nmmax);
Cyz[i] /= (double)(Nmmax);
Cxyz[i] /= (double)(Nmmax);
h[i] += 2.0/(double) mu*(Cxyz[i]*Cy[i]  Cxy[i]*Cyz[i])/6.0;
}
for (i=mmax;i!=N;i++)
{
for (j=mmax;j!=N;j++)
if (j!=i)
{
IYij = IXYij = IYZij = IXYZij = 0;
disx = disy = 0.0;
for (s=1;s!=m+1;s++)
disx = max(fabs(x[is]x[js]),disx);
for (s=1;s!=mmax+1;s++)
disy = max(fabs(y[is]y[js]),disy);
if (disy <= epsilon)
{
IYij=1;
if (disx <= epsilon)
IXYij = 1;
disz = max(fabs(y[i]y[j]),disy);
if (disz <= epsilon)
{
IYZij = 1;
if (disx <= epsilon)
IXYZij = 1;
}
} // end condition Yi  Yj < epsilon
h[i] += 2.0/(double) mu*(Cxyz[j]*IYij + IXYZij*Cy[j] 
Cxy[j]*IYZij  IXYij*Cyz[j])/(double)(6*(Nmmax));
} // end second loop over j
} // end loop over i
for (i=mmax;i!=N;i++)
T2 += h[i];
T2 /= (double)(Nmmax);
for (i=mmax;i!=N;i++)
h[i] = T2;
free (Cy);
free (Cxy);
free (Cxyz);
free (Cyz);
}
void InsertionSort(double *X, int *S, int M)
{
int i, *I;
int j;
int r;
double R;
I= (int*) malloc (M*sizeof(int));
for (i=0;i I[i]=i;
for (i=1; i {
R = X[i];
r = i;
for (j=i1; (j>=0) && (X[j]>R); j)
{
X[j+1] = X[j];
I[j+1] = I[j];
}
X[j+1] = R;
I[j+1] = r;
}
for (i=0; i S[I[i]]=i;
}
void uniform (double *X, int M)
{
int *I, i;
I = (int*) malloc (M*sizeof(int));
InsertionSort(X, I, M);
for (i=0;i X[i] = (double) I[i]/M*3.464101615; // to make unit
variance
}
/* normalize the time series to unit std. dev. */
void normalise(double *x, int N)
{
int i;
double mean=0.0, var=0.0;
for (i=0;i!=N;i++)
{
mean += x[i];
var += x[i]*x[i];
}
mean /= (double)(N);
var /= (double)(N);
var = mean*mean;
for (i=0;i!=N;i++)
x[i] = (x[i]mean)/sqrt(var);
return;
}
int main(int num_par, char *par[])
{
char infil1name[128]="test1.txt",infil2name[128]="test2.txt",
outfilname[128];
double *x, *y, tmp, epsilon=.50, VT2, p_T2, p_T21, *ohm, *cov,
T2_TVAL, T2_TVAL1, sigma[4][4];
int i, j, l, k, m=1, K, N;
long seed;
FILE *infil1, *infil2, *outfil;
// enter parameters from outside
if (num_par==1)
{
printf("Input file containing series 1: ");
scanf("%s", infil1name);
}
else
{
i=0;
do
{
infil1name[i]=par[1][i];
i++;
}
while (par[1][i1]!='\0');
}
if ( (infil1=fopen(infil1name,"r")) == NULL)
{
fprintf(stderr,"\nError: unable to open file containing series
1...%s\n",infil1name);
exit(1);
}
i = 0;
while (fscanf(infil1,"%lf", &tmp) != EOF)
{
i++;
}
fclose(infil1);
N=i;
if (num_par<3){
printf("Input file containing series 2: ");
scanf("%s", infil2name);
}
else
{
i=0;
do
{
infil2name[i]=par[2][i];
i++;
}
while (par[2][i1]!='\0');
}
if ( (infil2=fopen(infil2name,"r")) == NULL)
{
fprintf(stderr,"\nError: unable to open file containing series
2.\n");
exit(1);
}
i=0;
while (fscanf(infil2,"%lf", &tmp) != EOF)
{
i++;
}
fclose(infil2);
if ( i!=N)
{
fprintf(stderr,"\nError: files contain series of different
length.\n");
}
if (num_par<4)
{
printf("Input embedding dimension: ");
scanf("%d", &m);
}
else
m=atoi(par[3]);
if (num_par<5)
{
printf("Input bandwidth: ");
scanf("%lf", &epsilon);
printf("\n");
}
else
epsilon=atof(par[4]);
x = (double *) malloc(N*sizeof(double));
y = (double *) malloc(N*sizeof(double));
h = (double *) malloc(N*sizeof(double));
K = (int)(sqrt(sqrt(N)));
ohm = (double *) malloc(K*sizeof(double));
cov = (double *) malloc(K*sizeof(double));
// read the series
infil1=fopen(infil1name,"r");
infil2=fopen(infil2name,"r");
for (i=0;i {
fscanf(infil1,"%lf",&(x[i]));
fscanf(infil2,"%lf",&(y[i]));
}
normalise(x,N);
normalise(y,N);
// redun(x,y, ..) test statistic for X > Y
redun(x,y,N,m,m,epsilon);
ohm[0] = 1.0;
for (k=1;k ohm[k] = 2.0*(1.0k/(double)(K));
/* determine autocovariance of h[i] */
for (k=0;k!=K;k++)
{
cov[k] = 0.0;
for (i=m+k;i!=N;i++)
cov[k] += h[i]*h[ik];
cov[k] /= (double)(Nmk);
}
T2_TVAL=VT2=0.0;
/* variance of T2 */
for (k=0;k!=K;k++)
VT2 += 9.0*ohm[k]*cov[k];
T2_TVAL = T2*sqrt(Nm)/sqrt(VT2);
if (T2_TVAL>0)
p_T2 = 0.5  .5*erf(T2_TVAL/sqrt(2.0));
else
p_T2 = 0.5 + .5*erf(T2_TVAL/sqrt(2.0));
if ((num_par<6)  ((outfil=fopen(par[5],"w")) == NULL))
outfil=stdout;
else printf("The results are saved to the file: %s\n",par[5]);
fprintf(outfil,"Series length=%d, embedding dimension=%d,
bandwidth=%f\n",N,m,epsilon);
fprintf(outfil,"\nNull hypothesis: %s does not cause
%s\n",infil1name,infil2name);
fprintf(outfil,"T statistics=%.3f, pvalue=%1.5f\n",T2_TVAL,p_T2);
redun(y,x,N,m,m,epsilon);
ohm[0] = 1.0;
for (k=1;k ohm[k] = 2.0*(1.0k/(double)(K));
/* determine autocovariance of h[i] */
for (k=0;k!=K;k++)
{
cov[k] = 0.0;
for (i=m+k;i!=N;i++)
cov[k] += h[i]*h[ik];
cov[k] /= (double)(Nmk);
}
T2_TVAL=VT2=0.0;
/* variance of T2 */
for (k=0;k!=K;k++)
VT2 += 9.0*ohm[k]*cov[k];
T2_TVAL = T2*sqrt(Nm)/sqrt(VT2);
if (T2_TVAL>0)
p_T2 = 0.5  .5*erf(T2_TVAL/sqrt(2.0));
else
p_T2 = 0.5 + .5*erf(T2_TVAL/sqrt(2.0));
fprintf(outfil,"\nNull hypothesis: %s does not cause
%s\n",infil2name,infil1name);
fprintf(outfil,"T statistics=%.3f, pvalue=%1.5f\n",T2_TVAL,p_T2);
fcloseall();
return(0);
}
sotiria





Hi everybody!
I try to compile the following myfile.c file with the mex functionality of Matlab but it does not work.I get the message:
Mex file entry point is missing. Please check the (casesensitive)
spelling of mexFunction (for C MEXfiles), or the (caseinsensitive)
spelling of MEXFUNCTION (for FORTRAN MEXfiles). ??? Invalid MEXfile 'C:\MATLAB71\extern\myfile.mexw32': The specified module could not be found.
How should I write a mexfunction in the .C code?
The file myfile.c (performs a statistical test) is the following:
 myfile.c 
#include
#include
#include
#define max(a,b) a>b?a:b
double T2,*h;
//returns T2 statistics
void redun(double *x, double *y, int N, int m, int mmax, double
epsilon)
{
int i, j, s;
int IYij, IXYij, IYZij, IXYZij;
double disx, disy, disz, *Cy, *Cxy, *Cyz, *Cxyz, mu;
mu=pow(2.0*epsilon,m+2*mmax+1);
Cy = (double *) malloc(N*sizeof(double));
Cxy = (double *) malloc(N*sizeof(double));
Cyz = (double *) malloc(N*sizeof(double));
Cxyz = (double *) malloc(N*sizeof(double));
for (i=0;i!=N;i++)
h[i] = Cy[i] = Cxy[i] = Cyz[i] = Cxyz[i] = 0.0;
T2=0.0;
for (i=mmax;i!=N;i++)
{
Cy[i]=Cxy[i]=Cyz[i]=Cxyz[i]=0.0;
for (j=mmax;j!=N;j++)
if (j!=i)
{
disx = disy = 0.0;
for (s=1;s!=m+1;s++)
disx = max(fabs(x[is]x[js]),disx);
for (s=1;s!=mmax+1;s++)
disy = max(fabs(y[is]y[js]),disy);
if (disy <= epsilon)
{
Cy[i]++;
if (disx <= epsilon)
{
Cxy[i]++;
}
disz = max(fabs(y[i]y[j]),disy);
if (disz <= epsilon)
{
Cyz[i]++;
if (disx <= epsilon)
{
Cxyz[i]++;
}
}
} // end condition Yi  Yj < epsilon
} // end loop over j
Cy[i] /= (double)(Nmmax);
Cxy[i] /= (double)(Nmmax);
Cyz[i] /= (double)(Nmmax);
Cxyz[i] /= (double)(Nmmax);
h[i] += 2.0/(double) mu*(Cxyz[i]*Cy[i]  Cxy[i]*Cyz[i])/6.0;
}
for (i=mmax;i!=N;i++)
{
for (j=mmax;j!=N;j++)
if (j!=i)
{
IYij = IXYij = IYZij = IXYZij = 0;
disx = disy = 0.0;
for (s=1;s!=m+1;s++)
disx = max(fabs(x[is]x[js]),disx);
for (s=1;s!=mmax+1;s++)
disy = max(fabs(y[is]y[js]),disy);
if (disy <= epsilon)
{
IYij=1;
if (disx <= epsilon)
IXYij = 1;
disz = max(fabs(y[i]y[j]),disy);
if (disz <= epsilon)
{
IYZij = 1;
if (disx <= epsilon)
IXYZij = 1;
}
} // end condition Yi  Yj < epsilon
h[i] += 2.0/(double) mu*(Cxyz[j]*IYij + IXYZij*Cy[j] 
Cxy[j]*IYZij  IXYij*Cyz[j])/(double)(6*(Nmmax));
} // end second loop over j
} // end loop over i
for (i=mmax;i!=N;i++)
T2 += h[i];
T2 /= (double)(Nmmax);
for (i=mmax;i!=N;i++)
h[i] = T2;
free (Cy);
free (Cxy);
free (Cxyz);
free (Cyz);
}
void InsertionSort(double *X, int *S, int M)
{
int i, *I;
int j;
int r;
double R;
I= (int*) malloc (M*sizeof(int));
for (i=0;i=0) && (X[j]>R); j)
{
X[j+1] = X[j];
I[j+1] = I[j];
}
X[j+1] = R;
I[j+1] = r;
}
for (i=0; i Y
redun(x,y,N,m,m,epsilon);
ohm[0] = 1.0;
for (k=1;k0)
p_T2 = 0.5  .5*erf(T2_TVAL/sqrt(2.0));
else
p_T2 = 0.5 + .5*erf(T2_TVAL/sqrt(2.0));
if ((num_par<6)  ((outfil=fopen(par[5],"w")) == NULL))
outfil=stdout;
else printf("The results are saved to the file: %s\n",par[5]);
fprintf(outfil,"Series length=%d, embedding dimension=%d,
bandwidth=%f\n",N,m,epsilon);
fprintf(outfil,"\nNull hypothesis: %s does not cause
%s\n",infil1name,infil2name);
fprintf(outfil,"T statistics=%.3f, pvalue=%1.5f\n",T2_TVAL,p_T2);
redun(y,x,N,m,m,epsilon);
ohm[0] = 1.0;
for (k=1;k0)
p_T2 = 0.5  .5*erf(T2_TVAL/sqrt(2.0));
else
p_T2 = 0.5 + .5*erf(T2_TVAL/sqrt(2.0));
fprintf(outfil,"\nNull hypothesis: %s does not cause
%s\n",infil2name,infil1name);
fprintf(outfil,"T statistics=%.3f, pvalue=%1.5f\n",T2_TVAL,p_T2);
fcloseall();
return(0);
}
sotiria





Hi,
i'v a question ...
i'm trying to setup c++ compiler(not located)
(mex setup)...
after running a make file that uses mex, compiler couldn't be found ?!?...
message:
C:\PROGRAMME\MATLAB71\BIN\MEX.PL: Error: Unable to locate compiler.
Use mex setup to configure your environment properly.
Is there any special option to setup mex correctly in this case?
i'll be very glad to have your answer!
nina
 modified at 4:38 Tuesday 25th July, 2006





Salam
Did you use mex Setup? Did you follow the instructions?
Best regards,
A. Riazi





Hi again,
Ye!
is exactly what i did!
just like mex description!
It gives me:
Try to update options file: C:\Dokumente und Einstellungen\nina.MATRIXWARE\Application Data\MathWorks\MATLAB\R14SP3\mexopts.bat
From template: C:\PROGRAMME\MATLAB71\BIN\win32\mexopts\msvc50opts.bat
Done . . .
***************************************************************************
Warning: The file extension of 32bit Windows MEXfiles was changed
from ".dll" to ".mexw32" in MATLAB 7.1 (R14SP3). The generated
MEXfile will not be found by MATLAB versions prior to 7.1.
Use the output option with the ".dll" file extension to
generate a MEXfile that can be called in previous versions.
For more information see:
MATLAB 7.1 Release Notes, New File Extension for MEXFiles on Windows
***************************************************************************
i guess it's something with mex.pl (so that i'd said last time!)i've no idea how i could find the problem of this mex.pl!!!
best regards
nina





Hi again,
it's my problem:
it could not find cl.exe file, how should I configure mex setup ??
make
Could not find the compiler "cl" on the DOS path.
Use mex setup to configure your environment properly.
the makefile is:
% This make.m is used under Windows
mex O c svm.cpp
mex O c svm_model_matlab.c
mex O svmtrain.c svm.obj svm_model_matlab.obj
mex O svmpredict.c svm.obj svm_model_matlab.obj
could you tell me what is wrong?
thanx,
nina





Hi Mr. Riazi
I'v downloaded "mpgread" & "mpgwrite" packages(which are used to convert MPEG video files to matlab standard movie files & vice versa. But when I debug & run makedll.m file & then call mpgread, for example, in matlab command window ([R, G, B] = mpgread('f:\foreman.mpg', [1:20]);) this error message is shown:

Segmentation violation detected at Mon Jul 05 02:52:27 2004

Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License: 238685
Operating System: Microsoft Windows XP
Window System: Version 5.1 (Build 2600: Service Pack 2)
Processor ID: x86 Family 15 Model 2 Stepping 9, GenuineIntel
Virtual Machine: Java 1.4.2_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
(mixed mode)
Default Charset: ibm5348_P1001997
Register State:
EAX = 00000000 EBX = 00000001
ECX = 16131008 EDX = 11081da0
ESI = 0e0fafa4 EDI = 00000006
EBP = 00cddc74 ESP = 00cddc18
EIP = 0e0e774c FLG = 00210246
Stack Trace:
[0] mpgread.dll:0x0e0e774c(1, 0x0e0fafa4, 47, 0x11081d80)
[1] mpgread.dll:0x0e0e4b32(0x11081d80, 0x00cde6ac, 0x0e0faf90, 0)
[2] mpgread.dll:0x0e0e2c6a(0, 0x11081d80, 0x00cde6ac, 0)
[3] mpgread.dll:0x0e0e1cce(3, 0x00cde6ac, 2, 0x00cde70c)
[4] libmex.dll:_mexRunMexFile(3, 0x00cde6ac, 2, 0x00cde70c) + 103 bytes
[5] libmex.dll:public: virtual void __thiscall Mfh_mex::dispatch_file(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(3, 0x00cde6ac, 2, 0x00cde70c) + 157 bytes
[6] m_dispatcher.dll:public: virtual void __thiscall Mfh_file::dispatch_fh(int,struct mxArray_tag * *,int,struct mxArray_tag * *)(3, 0x00cde6ac, 2, 0x00cde70c) + 273 bytes
[7] m_interpreter.dll:int __cdecl mdDispatch(int,char const *,int,struct mxArray_tag * *,int,struct mxArray_tag * *,class Mfh_MATLAB_fn * *)(487, 0x110ff40c "mpgread", 3, 0x00cde6ac) + 88 bytes
[8] m_interpreter.dll:_inDispatchFromStack(487, 0x110ff40c "mpgread", 3, 2) + 801 bytes
[9] m_interpreter.dll:enum opcodes __cdecl inDispatchCall(char const *,int,int,int,int *,int *)(0x110ff40c "mpgread", 487, 3, 2) + 138 bytes
[10] m_interpreter.dll:int __cdecl inInterp(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag volatile *)(2, 0, 0, 0) + 2359 bytes
[11] m_interpreter.dll:int __cdecl inInterPcodeSJ(enum inDebugCheck,int,int,enum opcodes,struct inPcodeNest_tag *)(2, 0, 0, 0) + 272 bytes
[12] m_interpreter.dll:_inInterPcode(2, 0x78773d54, 0, 0) + 69 bytes
[13] m_interpreter.dll:enum inExecutionStatus __cdecl in_local_call_eval_function(int *,struct _pcodeheader *,int *,struct mxArray_tag * * const,enum inDebugCheck)(0x00cdf2c8, 0x00cdf3b4, 2, 1) + 162 bytes
[14] m_interpreter.dll:$L73181(0x78773d54, 0x0f954cd0 "[R, G, B] = mpgread('f:\foreman...", 0, 0) + 196 bytes
[15] m_interpreter.dll:enum inExecutionStatus __cdecl inEvalCmdWithLocalReturnandtype(char const *,int *,enum inDebugCheck)(0x0f954cd0 "[R, G, B] = mpgread('f:\foreman...", 0, 2, 0x00cdf444 "ôôÍ") + 69 bytes
[16] m_interpreter.dll:_inEvalCmdNoEnd(0x0f954cd0 "[R, G, B] = mpgread('f:\foreman...", 0x00cdf4e4, 0x00cdf49c, 0x01493f28) + 16 bytes
[17] bridge.dll:_mnParser(0x7c80b529, 0x01493f28, 0, 0) + 431 bytes
[18] mcr.dll:public: void __thiscall mcrInstance::mnParser(void)(271268, 0x4d5c3a45, 0x6f6a6861, 0x4d5c6275) + 87 bytes
[19] MATLAB.exe:0x00401d2f(4194304, 0, 271268, 0x01493f28)
[20] MATLAB.exe:0x00403e45(0x00c5dd60, 0x7c90e1fe "¸±", 0x7ffda000, 0x8054a938)
[21] kernel32.dll:0x7c816d4f(0x00403cc0 "jth8U@", 0, 0, 0)
This error was detected while a MEXfile was running. If the MEXfile
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEXfiles.
If it is an official MathWorks function, please
follow these steps in reporting this problem to The MathWorks so
that we have the best chance of correcting it:
1. Send this crash report to segv@mathworks.com for automated analysis.
For your convenience, this information has been recorded in:
C:\DOCUME~1\TCTTOH~1\LOCALS~1\Temp\matlab_crash_dump.3800
2. Also, if the problem is reproducible, send the crash report to
support@mathworks.com along with:
 A specific list of steps that will reproduce the problem
 Any M, MEX, MDL or other files required to reproduce the problem
 Any error messages displayed to the command window
A technical support engineer will contact you with further information.
Thank you for your assistance. Please save your workspace and restart
MATLAB before continuing your work.
//////////////////////////////////////////////////////////
Please help me to solve the problem.
Thanks in advance & best regards
H Mahjoub
 modified at 20:01 Wednesday 5th July, 2006





Hi,
First of all I would like to congratulate you for your articles, that I found to be very good and very informative.
The question I have to you is if it is possible to do this exact task using Lcc, instead of Microsoft visual Basic C++ ? The problem is that my company doesn't have VC++, so as we need to call C functions from matlab, I was thinking if it is possible to do this task using other compiler.
My MatLab version is R2006a.
Best regards,
Pedro Cardoso





In theory you can use LCC, Watcom, Borland and Microsoft compilers. For other compilers than VC++, you must use proper libraries and preprocessors. Just read MATLAB Compiler documents and also refer to its site.
Best regards,
A. Riazi





Hi,
Thank you for your answer. But what's the easier way to call C functions from MatLab ? I tried a simple example that adds two numbers, and it worked correctly, but now I want to make a MEX file that has several functions and call each one of them. The goal is to use a C software from ITU (ITUR P.452). This software has lots of functions, to read/write from/to a file and do propagation calculations. What can I do to overcome this obstacle ? I searched all over the internet and I can't create a MEX that works with the software.
Best regards,
Pedro Cardoso





Dear Sir,
I am very much new to matlab...please tell me the following things... do i need matlab installed on the computer where i want to ship my application developed in vc++ using matlab max file and compiled though mcc and created a lib file....
thanks







General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Type  Article 
Licence  
First Posted  20 Sep 2003 
Views  343,279 
Bookmarked  37 times 

