matlab-engine

MATLAB Engine Windows 7 problem

社会主义新天地 提交于 2019-12-04 17:12:13
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 did a couple of searches and all I found was that there is a simmilar porblem with adobe cs5, Also I

Data streaming in MATLAB with input data coming in from a C++ executable

*爱你&永不变心* 提交于 2019-12-04 09:24:23
I'm completely new to MATLAB and I want to know what my options are for data streaming from a C++ file. I heard of using the MATLAB "engine" for this purpose, and some of the methods like engPutVariable, etc., but can someone give me a thorough example of how to go about doing it? I'm trying to implement streaming a sine wave, but a simple example of sending a sample set of data through should suffice. You have two options: the matlab engine and mex functions. It's very important to note that the Matlab API is single-threaded. There is absolutely no way to have user-visible background threads.

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

允我心安 提交于 2019-12-04 03:07:38
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 to missing libs: 1>engwindemo.obj : error LNK2019: unresolved external symbol _engClose referenced in

Multithreaded C++ application using Matlab Engine

我的未来我决定 提交于 2019-12-02 21:33:12
问题 I open Matlab engine in an initialization thread, doing : bool MY_MATLAB_ENGINE_o::Open() { // Handle the case where engine is already open if( MatlabEngine ) { return true; } else if( !( MatlabEngine = engOpen( 0 ) ) ) { return false; } IsEngineOpen.SetValue( true ); return true; } Function engOpen() opens a COM channel to Matlab. Once the engine is open, the thread falls in wait event mode. Then, in another thread, I do this : bool MY_MATLAB_ENGINE_o::ChangeDirectory( QString strPath ) {

Multithreaded C++ application using Matlab Engine

◇◆丶佛笑我妖孽 提交于 2019-12-02 09:57:16
I open Matlab engine in an initialization thread, doing : bool MY_MATLAB_ENGINE_o::Open() { // Handle the case where engine is already open if( MatlabEngine ) { return true; } else if( !( MatlabEngine = engOpen( 0 ) ) ) { return false; } IsEngineOpen.SetValue( true ); return true; } Function engOpen() opens a COM channel to Matlab. Once the engine is open, the thread falls in wait event mode. Then, in another thread, I do this : bool MY_MATLAB_ENGINE_o::ChangeDirectory( QString strPath ) { QString strPathToScript = "cd('" + strPath + "');"; QByteArray ba = strPathToScript.toLatin1(); const

Accessing MATLAB's unicode strings from C

送分小仙女□ 提交于 2019-12-02 04:03:33
问题 How can I access the underlying unicode data of MATLAB strings through the MATLAB Engine or MEX C interfaces? Here's an example. Let's put unicode characters in a UTF-8 encoded file test.txt, then read it as fid=fopen('test.txt','r','l','UTF-8'); s=fscanf(fid, '%s') in MATLAB. Now if I first do feature('DefaultCharacterSet', 'UTF-8') , then from C engEvalString(ep, "s") , then as output I get back the text from the file as UTF-8. This proves that MATLAB stores it as unicode internally.

How do I use Matlab engine in my code (for calling `engOpenSingleUse()`)?

北战南征 提交于 2019-12-01 22:23:13
I'm trying to send simple string commands to the Matlab engine. This is my code (there is no Matlab API related code anywhere else in my code, except for the #include "engine.h" line): void MatlabPlotter::DrawInMatlab() const { std::string PlotCommand = "x=[0 1 2 3 4 5];y=[0 1 4 9 16 25];plot(x, y);"; void * vpDcom = NULL; int iReturnValue; engOpenSingleUse(PlotCommand.c_str(), vpDcom, &iReturnValue); } The code compiles and runs successfully without any compiler errors or run time error messages. The "Matlab Command Window" opens; I get a screen like below: As you see, the command window is

Connect to Matlab engine from C in Linux

丶灬走出姿态 提交于 2019-11-30 13:34:13
I'm trying to call the Matlab engine programatically from a C program on Linux (Matlab r2009a, Ubuntu 9.10). I've got my own code (which works in Windows), but for now I'm just trying to get the Matlab "engdemo.c" program to work on Linux. I have managed to compile & link it (after including about 15 -l<lib> switches on the gcc command line), and even resolved all the runtime dynamic links via some ldconfig magic. But, when the program runs, I just get the "Can't start MATLAB engine" error message and the program ends, with no indication of why it failed. Has anybody made this work? What have

How to efficiently convert Matlab engine arrays to numpy ndarray?

不羁岁月 提交于 2019-11-30 05:12:38
I am currently working on a project where I need do some steps of processing with legacy Matlab code (using the Matlab engine) and the rest in Python (numpy). I noticed that converting the results from Matlab's matlab.mlarray.double to numpy's numpy.ndarray seems horribly slow. Here is some example code for creating an ndarray with 1000 elements from another ndarray, a list and an mlarray: import timeit setup_range = ("import numpy as np\n" "x = range(1000)") setup_arange = ("import numpy as np\n" "x = np.arange(1000)") setup_matlab = ("import numpy as np\n" "import matlab.engine\n" "eng =

Connect to Matlab engine from C in Linux

烈酒焚心 提交于 2019-11-29 19:41:20
问题 I'm trying to call the Matlab engine programatically from a C program on Linux (Matlab r2009a, Ubuntu 9.10). I've got my own code (which works in Windows), but for now I'm just trying to get the Matlab "engdemo.c" program to work on Linux. I have managed to compile & link it (after including about 15 -l<lib> switches on the gcc command line), and even resolved all the runtime dynamic links via some ldconfig magic. But, when the program runs, I just get the "Can't start MATLAB engine" error