f



Error when calling Matlab engine using C++ - unhandled exception

I tried to call the Matlab engine (as demonstrated in engwindemo.c) using Visual C++ (VS2008) but kept having random unhandled exceptions occuring.

The c++ application that calls the matlab engine needs to load several dll files that are located in "\bin\win32" directory of the matlab folder. This folder is added to the PATH environment variable so that the C compiled applications can find these dll files.

The unhandled exceptions were caused because erroneous dll files are loaded. 
I happen to have installed in my PC the Celoxica / Agility DK design suite for compiling code from MATLAB , C to FPGA. It appears that the Celoxica suite also contains a folder with identical dll filenames (but not identical modules) as the ones required by the Matlab Engine. The Celoxica dll files are also present in the system PATH so when I executed my C++ application, the first dll files to be loaded were from the Celoxica folder and NOT from the Matlab folder. Hence the unpredictable behaviour.

So if you have the Celoxica / Agility DK suite installed on the same PC as Matlab, and cannot start the Matlab Engine via VS C++, have the above in mind.

I solved this by temporarily removing the conflicting Celoxica folders from the PATH environment variable.

OS: Vista 32bit
Matlab ver: 7.6.0.324 (R2008a)
DK Design Suite: 5.0
0
6/20/2009 4:02:00 AM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
939 Views

Similar Articles

[PageSpeed] 14

Reply:

Similar Artilces:

methods to call matlab in C C++ and call C C++ in matlab
Hi, I am reading the help documents about how to program matlab and C C++ together and my questions are a little bit general. It seems that are several ways to call matlab in C C++ and another several ways to call C C++ in matlab. Please correct me if I am wrong or missing something when I try to list them. To call matlab code in C C++, are there two methods available? The first one is Matlab engine and the second one is to use MATLAB Compiler mcc to create C or C++ shared libraries from your MATLAB code. To call C C++ in matlab, are there also two methods? The first one is to call funct...

How to call matlab functions directly from C++ /without calling matlab engine
How to call matlab functions directly from C++ without calling matlab engine. as it is described in this tutorial: http://www.codeproject.com/samples/matlab_cpp.asp I have tried to do something similar in Visual Studio 2005 [Matlab 7, r14] #include <mclcppclass.h> .... mwArray A, B, C; A = magic(mwArray(5)); B = transpose(A); .... but it doesn't compile. I got following errors: error C3861: 'magic': identifier not found error C3861: 'transpose': identifier not found etc... I was looking for header files with declarations of this functions in matlab directory...

Check for matlab error from Matlab Engine call
Hi, I am using the matlab engine from a C++ program. I call engEvalString() and check for the return value, but the result is zero, even if a Matlab error (like "Undefined function or variable '...') occurs. Is there any way to find out if a Matlab error occured? Thanks, Philipp ...

matlab beginner: calling matlab from C/C++
I'm relatively new to the world of Matlab. I want to call my matlab own code from a C/C++ program on a machine with matlab installed. Do I need to compile the matlab code using matlab compiler tool or the matlab engine is enough for this? Thanks a lot for your help On Nov 28, 10:03 am, "Paeo Campigotto" <campigo...@dit.unitn.it> wrote: > I'm relatively new to the world of Matlab. > I want to call my matlab own code from a C/C++ program on a > machine with matlab installed. > Do I need to compile the matlab code using matlab compiler > tool or the matla...

C/C++ in matlab and matlab in C/C++ ?
Is it possible to read C/C++ code in matlab and the other way around too? Hi, as long as C or C++ are written in text files you can edit them in the matlab editor. To see the special character of C or C++ coding language, in the editor go to menus: file>preferences>Edito/Debugger>language and on popup "Language" select "C/C++". This does not allow you to run the C/C++ code, just to view it i nicer way... regards, chris saneman <asdfsdf@asd.com> wrote in message <frl846 $f8i$2@news.net.uni-c.dk>... > Is it possible to read C/C...

Conversion from MATLAB to C/C++ using MATLAB compiler
I am working on conversion of .m files to c/c++. I am using the MATLAB compiler version 3.0 and MATLAB version 6.5.1. There seem to be a few functions which do not seem to get converted. The error i got while using functions like TRAIN, NETWORK and INIT (all neural-networks related functions used in the general neural network programs, newpnn.m etc) is The MATLAB compiler does not currently support MATLAB object oriented programming and the functions TRAIN , NETWORK and INIT would produce a run-time error. Could anyone please tell me as to how i can circumnavigate this problem or solve this...

matlab beginner: calling matlab from C/C++ #2
I'm relatively new to the world of Matlab. I want to call my matlab own code from a C/C++ program on a machine with matlab installed. Do I need to compile the matlab code using matlab compiler tool or the matlab engine is enough for this? Thanks a lot for your help ...

matlab calling DLL vs. .exe calling matlab engine
Hello, I'm writing an 3D image recognition which sends commands via RS232 to a Robot which moves to the point in 3D. The problem is the serial interface: sending string commands via serial/fprintf is very slow (I really don't know what matlab makes before sending them) in comparison to e.g. Windows hyperterminal. My question is if it is better to execute a dll out of Matlab-code doing the serial things or viceversus writing a program in c++ which uses the matlab-engine ? What could be the fastest way? What are advantages/disadvantages ? Any help would be appreciated. Thanks in advanc...

Using MATLAB engine from languages other than C/C++?
Hello! I've been integrating my C++ programs with MATLAB, but is it possible to envoke MATLAB engine from any other object-oriented language, such as C# or Java? Thanks in advance, Domagoj Jakobovic ...

Calling MATLAB Engine from C
I am creating an application that has 3 C files: convert.c(has main() in it) memconv.h(has declaration for just 1 function, memAlloc) memconv.c (has definition for the memAlloc function) I have included memconv.h in convert.c Now I try to compile the application on Command-Prompt using following command : mex -f c:\matlab6p5\bin\win32\mexopts\msvc60engmatopts.bat convert.c memconv.c It successfully creates convert.exe. However, on executing it crashes immediately. In other case, when I paste the memAlloc function in convert.c, and compile just one file i.e. convert....

Calling Matlab Engine from C
Hi I have a code written in C. I want to call a matlab's M-file from this C code. I have already successfully executed the sample 'engdemo.c' file. what i am unable to do is to make matlab engine run this 'Load.m' file directly when it opens without me having to type in the code in the matlab command window. How can i make this happen? How to pass the name of the M-file which i want MATLAB to execute? Please help if you can!! Thanks in advance. Arpita "Arpita " <hi_arpita200222@yahoo.co.in> wrote in message news:g8i1vl$s6b$1@fred.mathworks.com... >...

Incremental saving of matfiles using matlab engine and matrix library with c/c++
Hi, I am using the matlab engine and matrix library to save simulated data out of a c++ project into a mat file. The simulated data includes several structures with several fields. The problem is, that the simulation produces a large amount of data so the memory is too small to store this data to the end of the simulation and save it into a mat file. Is it possible to store the simulated data incrementally in a mat file. For example every n simulation cycles? Actually I produce sub mat files, but this is only a work around. Regards, Andreas ...

Shall i use the misrosoft Visual c++ code from a m-file generated from matlab in Visual C++ with out matlab runtime environment
undefined ...

calling sas using matlab (or conditional deletion in matlab)
my issue: i only need data past a certain date for a large number of time series. is this possible in matlab? i have been toying around with different ways, and found one solution (descending sort paired with a conditional statement). for example if x(i)<datenum(1/1/2006,'mm/dd/yyyy') then delete else keep ....etc i know this is not matlab code, but it explains my goal. but, i would prefer a more concise way of executing this step. with this, is there any way to call sas code with matlab? (makes parsing data obviously much more concise). any input would be greatly appreciated. ...

Converting Matlab code to C using Matlab Compiler
Hello All, Please can I get some guidance on how to Convert a structure from Matlab code to C code using Matlab Compiler. Kind regards Sammy ...

Call C code from Matlab -> Matlab crash
Hello, I have a problem calling C code from Matlab. The mex file compilation is ok. When I run the program Matlab (7.3) crashes. Below is the mexFunction code. Any idea is welcome. (I think the main part of the code (middle part) is not useful for the crash problem, but I put it anyway). //########################################################### #include "math.h" #include "mex.h" void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { // Standard variables int p,r,h,i,j,f,w; // Indices for loop int MAX_NBM = 1000; int MAX_DIM = 10; int MAX_NB_CLUST = 20; double *SF, *km, *new_data; int size, dim, K, nbm, aux_size, count_bis, count_aux; double diam_max, diam, vec1_p, vec2_p, dist_min, dis; int combi[1000000][2]; int dist_aux[1000000][2]; /* Check for proper number of arguments. */ if (nrhs != 5) { mexErrMsgTxt("5 input required."); } else if (nlhs > 1) { mexErrMsgTxt("Too many output arguments"); } // Input parameter (MATLAB) new_data = mxGetPr(prhs[0]); size = (int)mxGetScalar(prhs[1]); dim = (int)mxGetScalar(prhs[2]); K = (int)mxGetScalar(prhs[3]); km = mxGetPr(prhs[4]); // Output parameter (MATLAB) plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL); SF = mxGetPr(plhs[0]); // Other variables nbm = size/dim; // Number of points printf("Taille: %d\n",nbm); printf("Dimension: %d\n",dim); //#############################...

error using matlab script block with matlab 7.0
Hello, &nbsp; I'm using along several months in my vi's the matlab script block using 6.1 and 6.5 matlab script version and I haven't got any problem. Today I've installed matlab 7.0 and the matlab script block, but matlab script block never shows errors and I dont' know whyit happens. &nbsp; Someone knows which can be the problem.....is not compatible with matlab 7.0....i have to update labview?? &nbsp; Thanks &nbsp; Larson Thank you very much diego....i haven't found this forum topic. &nbsp; Bye! ...

Errors in using Matlab in C# application .....
The application that I have a made is just an example of how to use .Net builder in Matlab. But I am having a few exceptions while running the C# Application due to the assembly created by the matlab code. The application can be downloaded from: http://www.mediafire.com/?reby2cc6hdglsir You may check it and tell me if there is any correction ! Thank You :) Somebody please help !!!! I really need this problem to be solved ...... !!! :( ...

Errors using C functions of Matlab
Hi!! I'm trying to make a code to use matrix to read a file, but when I try to copy the read value to a mxArray it gives the next errors: $ make g++ -Wall -g -O3 -I. -I../include -I/usr/cad/systemc/systemc_2_1.oct_12_2004.be ta/include -I/usr/cad/systemc/systemc_2_1.oct_12_2004.beta/src -o .../obj/moduleM atrix.o -c ../src/moduleMatrix.cpp .../src/moduleMatrix.cpp: In member function `void Matrix::CreateData()': .../src/moduleMatrix.cpp:89: error: call to non-function `Array::array' .../src/moduleMatrix.cpp: At global scope: .../src/moduleMatrix.cpp:109: error: parse error at end ...

Call C code from Matlab -> Matlab crash #2
Hello, I have a problem calling C code from Matlab. The mex file compilation is ok. When I run the program Matlab (7.3) crashes. Below is the mexFunction code. Any idea is welcome. (I think the main part of the code (middle part) is not useful for the crash problem, but I put it anyway). //########################################################### #include "math.h" #include "mex.h" void mexFunction (int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { // Standard variables int p,r,h,i,j,f,w; // Indices for loop int MAX_NBM = 1000; int MAX_DIM = 10; in...

converting c++ code to Matlab code using Matlab 9
im working on a project using matlab. i want to use some of the already writen codes in C++. i want to use these codes in my project rather than writing them from scratch. is there some way or a chunk of code that might convert C++ code to matlab code or a ".c" file to ".m" file. please if anyone knows do let me know at the earliest.thanks "fatima " <fatima_naseem2002@yahoo.com> wrote in message <i8ugqn$e9p$1@fred.mathworks.com>... > im working on a project using matlab. i want to use some of the already writen codes in C++. i want to use these c...

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??? ...

error using C function in Matlab
I'm trying to link a C function in Matlab version 7.0 (R14), it gives me an error which reads Error unravel.c: 25 redeclaration of `mexFunction' previously declared at C:\MATLAB701\extern\include\mex.h 138. Could u plz provide me the workaround? The function is the same one given on Digital Image Processing using MATLAB (II Ed.) by Gonzalez, Woods on page no. 305 for ur reference. thanx...Limi ...

Using MatLab in C/C++
Is it possible to call MatLab or a MatLab function in C or C++? If so, where can I find info on how to do that? Mike On Feb 11, 8:57 am, "Michael Stachowsky" <mstachow...@gmail.com> wrote: > Is it possible to call MatLab or a MatLab function in C or > C++? If so, where can I find info on how to do that? > > Mike See the Matlab engine http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f38569.html Chris "Michael Stachowsky" <mstachowsky@gmail.com> wrote in message <fopk7d$bs2$1@fred.mathworks.com>... > Is it possibl...

vectorized computation in C++ such as those in Matlab (Matlab to C++)?
Dear all, Can C++/STL/Boost do the vectorized calculation as those in Matlab? For example, in the following code, what I really want to do is to send in a vector of u's. All other parameters such as t, l1, l2, l3, etc. are scalars... But u is a vector. Thus, t6 becomes a vector. t9 is an element-wise multiplication... The following code was actually converted from Matlab. If vectorized computation is not facilitated, then I have to call this function millions of times. But if vectorized computation is okay, then I can send in just a u vector with batch elements a time. I have many such code in Matlab need to be converted into C++ with vectorization. Any thoughts? Thank you! double t5, t6, t7, t9, t11, t13, t16, t20, t23, t27, t32, t34, t36, t37, t38, t42, t44, t47, t48, t51, t52, t54, t59, t60, t61, t66, t67, t69, t74, t75, t76, t81, t82, t84, t87, t105, t106, t110, t112; t5 = exp(-t * l1 - t * l2 - t * l3); t6 = t * u; t7 = mu1 * mu1; t9 = u * u; t11 = kappa * kappa; t13 = 0.1e1 / (t9 * t7 + t11); > Dear all, > > Can C++/STL/Boost do the vectorized calculation as those in Matlab? > > For example, in the following code, what I really want to do is to > send in a vector of u's. > > All other parameters such as t, l1, l2, l3, etc. are scalars... > > But u is a vector. > > Thus, t6 becomes a vector. > > t9 is an element-wise multiplication... > > The following code was actually converted f...

Web resources about - Error when calling Matlab engine using C++ - unhandled exception - comp.soft-sys.matlab

Unhandled Exceptions
As a member of the Telerik Insiders Team, Telerik can help facilitate my delivery of talks at your user group or software development event. ...


Error'd: Click Here to 'Like' Unhandled Exceptions
Alexander writes, "I was searching the web for solutions to some Oracle OCI driver issues when a I received a curious suggestion." "Finally, ...

Blue Screen of Death - Wikipedia, the free encyclopedia
or a bug check , is the error screen displayed by the Microsoft Windows family of operating systems upon encountering a critical error, of a ...

Unhandled Exception
Sorry for the inconvenience, you request cannot be entertained at this moment.

Error
Oops something went wrong! Either the site is offline or an unhandled error occurred. We apologize and have logged the error. Please try your ...

WebHost4Life: When Good Web Hosting Companies Go Bad
Server Error in '/site1/weblog' Application. Exception of type 'System.OutOfMemoryException' was thrown. Description: An unhandled exception ...

Abhinav Singh - XMPP, Erlang, PHP, Realtime System Architect, Consultant and Freelancer, Bangalore, India ...
Abhinav Singh is XMPP, Erlang, PHP, Realtime System Architect, Consultant and Freelancer from Bangalore, India.

Site map
AISolutions Home News & Media Site Map search Search Home Company About Us News & Media Customers GSA Schedules Community Outreach Contact Us ...

Security and the real world
When talking about Security, most people think about something where "they" attack and "we" defend. If they succeed only once, we have lost. ...

Resources last updated: 3/20/2016 8:16:41 PM