matlab-engine

Calling MATLAB from a DLL

老子叫甜甜 提交于 2019-12-23 02:38:31
问题 I have a DLL written in C++ that is used to modify parameters in VISSIM (traffic simulator). Within this DLL, I would like to call MATLAB to send data, perform MATLAB functions, and return data to the DLL. This all occurs outside of an IDE as VISSIM calls the DLL as necessary. I have (1.) a working DLL that properly modifies VISSIM parameters and (2.) a working .cpp program that opens the MATLAB Engine (these two programs are currently separate - independent of each other). How can I combine

problem with nvmex in matlab

血红的双手。 提交于 2019-12-13 20:04:38
问题 i have installed matlab on my system and also have installed the CUDA SDK for windows. however i am not able to compile any .cu files. I have included the nvmex script file in the bin directory of the Matlab installation path. Can some body help? 回答1: nvmex isn't really supported in any recent versions of Matlab or the Cuda SDK. Instead, I would suggest writing a simple DLL in Visual Studio which uses the standard MEX interface to run Cuda. I'm going to assume that your project is called

Problems including MATLAB “engine.h” for C++ code

纵饮孤独 提交于 2019-12-12 08:29:17
问题 I am trying to run the example code from the MATLAB Doc, but when I try to build the project in Visual Studio I get this error fatal error C1083: Cannot open include file: 'engine.h': No such file or directory The fact is that in the Doc I cannot find where to find the header to link it, they show the examples as if there was no need to do anything else, just do the #include "engine.h"; Any ideas about how to solve this issue? EDIT I solved the first problem but now I get some errors reated

Undefined reference in make

爱⌒轻易说出口 提交于 2019-12-12 03:55:26
问题 I'm compiling a code with many files and some are located in the local MATLAB installation folder. For this I've added an include to g++ which apparently doesn't resolve well because I get an undefined reference to for all MATLAB-C++ functions (I'm trying to use the MATLAB C++ Engine) as shown in the following screenshot: The Makefile is very short and as such: I've checked the referenced directory and it does include the "Engine.h" referenced by constraints.cpp which is generally enough to

Error linking Matlab with C++

懵懂的女人 提交于 2019-12-11 05:29:26
问题 I'm trying to use Matlab library in C++ program: #include <cstdlib> #include <cstdio> #include <string.h> #include "engine.h" using namespace std; int main(int argc, char** argv) { Engine* mweng = engOpen(""); engEvalString(mweng, "n = func(5)"); printf ("%d",engGetVariable(mweng, "n")); engClose(mweng); return 0; } I compile my project with g++ with included MATLABROOT\extern\include directory and have a following error: build/Debug/Cygwin-Windows/main.o: In function `main': /cygdrive/d

Call Matlab in C++ code - using methods in engine.h

北城余情 提交于 2019-12-10 11:56:24
问题 I write a C++ program whose only purpose is to call Matlab code. I have a main routine, which read data in a file (matrices with high dimension 90000*24) into C++ structures pass these structures to Matlab code launch the Matlab routine with these structures in argument get the output data from Matlab and store them in C++ structures In 2/, matrices are fields in a Matlab struct. The struct, say MATLAB_STRUCT has several matrix fields, MATLAB_STRUCT.Z1 , MATLAB_STRUCT.Z2 ,... and some float

Passing C/C++ callbacks into the matlab engine

空扰寡人 提交于 2019-12-10 09:44:18
问题 I have a C++ file that: starts the matlab engine calls matlab_optimize() (a compiled m file that runs one of matlab optimizers internally) prints the result stops the engine and quits This works fine. I now want to change the second line into calls matlab_optimize(obj_fun) Where obj_fun() is a function defined in my C++ code which itself will callback into other code. Essentially I want the matlab optimizer used internally in matlab_optimize to use my supplied function pointer as the

Assertion in MEX file causes Matlab to crash

你。 提交于 2019-12-07 17:45:44
问题 I'm using the mxAssert -macro defined by matrix.h in my C++ code which mex perfectly compiles. When an assertion is violated in my called mex code, this assertion causes not my program to crash but Matlab itself. Am I missing something out? Is that intended behavior? When I look at Matlab's crash report, the causing assertion is the very same raised by my code - including my descriptive description... Do I have to run my mex code in a certain way so that Matlab can recognize mex code caused

MATLAB Engine Windows 7 problem

ⅰ亾dé卋堺 提交于 2019-12-06 10:46:57
问题 I am trying to figure how to use the Matlab engine so I can use C++ GUI with matlab function however I am having some trouble trying to figure out how to use the MATLAB engine classes. The first thing I did was try to run their examples after a bit of trying I go this error upon a successful build, "The application was unable to start correctly 0xc000007b" How do I fix this and will this? In addition I attempted to run my own code too, even though it was simple it still did not work. Note: a

Sending a matrix with each iteration: Matlab “engine.h” c++

烂漫一生 提交于 2019-12-06 05:03:06
问题 This question comes after solving the problem I got in this question. I have a c++ code that processes frames from a camera and generates a matrix for each processed frame. I want to send to matlab engine each matrix, so at the end of the execution I have in stored all the matrices. I am conffused about how to do this, I send a matrix in each iteration but it is overwritting it all the time, so at the end I only have one. Here is a code example: matrix.cpp #include helper.h mxArray *mat; mat