How to call matlab functions directly from C++ /without calling matlab engineHow 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...
Call a Matlab function from Java running in matlab.Hi guys. I really apologize for asking this question, since I'm sure it is either basic or not possible, but I have been reading through the documentation and can't seem to figure this out, since the examples look like they just send and receive variables from the Java methods.
Could anyone give me a short example of how to call a method from a Java object that causes some sort of action to be performed in MATLAB?
For example, I would like to:
1) make a new object of MyClass from MATLAB called MyObject.
2) run MyObject.DoSomethingInMatlab()
3) have a statement in DoSomethingInMatlab...
Call Matlab functions from mex (matlab function's input is string)Here is my mex code:
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){
char errBuff[1]={'A'};
//create mxArray pointer
mxArray *mxerr;
//copy errBuff to mxArray
mxerr = mxCreateString(errBuff); //initialize mxArray with errBuff char array, return to pointer
//call matlab function
mexCallMATLAB(0,NULL, 1,mxerr, "errorCatcher");
//destroy mxArray
mxDestroyArray(mxerr); //destroy mxArray
printf("destroyed mex array\n");
}//end of mexFunction
errorCatcher accepts string inp...
Calling Compiled MATLAB from MATLABHello everyone,
How do I compile MATLAB M files into a form that can then be called
from within the MATLAB interpreter? A roundabout way would seem to be
to (somehow) Turn the matlab code into C (I think mcc does this), then
compile this C code into MEX format and call that. Is there an easier
way? I have the MATLAB compiler, so I just need to know what to do with
it to get this to work.
Thanks in advance,
Sina
sina.tootoonian wrote:
>
>
> Hello everyone,
>
> How do I compile MATLAB M files into a form that can then be called
> from within the MATLAB interpreter? A round...
Calling Matlab in C in MatlabHi everybody!
My problem can be described as follows.
I have a tool in Matlab that requires calling an optimisation
algorithm in C. This algorithm consists of several C-files, one of
which contains the function to be minimised (CFUNCTION), and another
is the main algorithm file (CMAIN).
Now what I want to do is to call Matlab from CFUNCTION or CMAIN and
specify my custom function (MFUNCTION) to be minimised.
So, I'm calling Matlab from C from Matlab.
I'm a newbie in C and MEX files. Should I rewrite CMAIN as a MEX file
and include CFUNCTION in this and then use mxCallMATLAB? Or can...
mex - matlab calls fortran which calls matlab which calls fortranDear All,
I'm trying to link matlab and fortran with mex files and engine matlab, in linux OS. My general purpose is the following:
1) a matlab script A calls a mex function B based upon fortran source code
2) mex function B calls another function in matlab C within matlab engine
3) matlab routine C calls another mex file in fortran D
While i'm able to do steps 2) and 3), I can't do step 1). Before to show the code, please reply to this simple question:
Is it possible to build the overall process 1-3?
On 8 Okt, 16:37, "Michele Catalano" <cata...@yahoo.it> wr...
Display Matlab messages when the function is called by Labview via Matlab scriptI use Labview (version 6.1) to send variables to Matlab (version 7.0.4) via Matlab script and I would like to display some message on the command window of Matlab.
The messages are displayed when I call my Matlab function from the command window of Matlab but not when the function is called from Labview.
Do you have any idea how to solve this problem ?
Regards,
Julien.
...
Matlab abort when calling system generator function from a normal matlab fileHi,
I implemented some functions using system generator (simulink) and I need to perform some statistical analysis on these functions which involves multi-colouring test.
I wrote a matlab file to call these functions inside of a for loop. But for some reason, after a few runs, Matlab just automatically quit without any warning or error messages.
Does anyone know why this is happening? At least any suggestion on whether it's Matlab's problem or system generator's problem?
Any help would be appreciated.
Joy
...
call Visual basic gui or function from matlab guihello friends,
I have an activeX control developed in Visual C++ to acquire data from a Data acquisition system. Currently I am using this activex in a VB GUI because someone in my group knew how to use it through VB. However, after acquiring the data i am processing it in matlab. Thus i have two GUIs one in VB and other in matlab.
I have two questions,
can I access this VC++ activex in a matlab GUI ? if yes, how? I dont know VC++ and VB both :( ...
if that is complicated then, Can i access this VB GUI from my matlab GUI? so that i need not operate with separate programs.
hope my questi...
matlab calling DLL vs. .exe calling matlab engineHello,
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...
Run Matlab ... from MatlabHello,
Is there any limitation to run Matlab from Matlab, as a system command, on Linux platforms ?
I tried to start Matlab, both using the ! syntax (!matlab&) or the system command (system('matlab&')), the Matlab splash screen appears, but the new Matlab session closes rapidly .
When I do the same with a script of mine (system('matlab -r "myscript"&')), my script is being executed, but Matlab finally crashes .
If I remove the &, it works well, but the first Matlab session is blocked till I close the second one .
I run Matlab on a Linux 64bits pla...
MATLAB talking to MATLAB?For my project, I need to have a client program (MATLAB executable) talking
to a server program (also MATLAB executable) to query data. Is there any
easy way to accomplish that?
I appreciate any help that I can get on that.
Thanks.
Cheers,
Hoi
Oops, I forgot to mention. There are multiple clients querying the server,
so I guess serial objects + remote serial port wouldn't work.
"Hoi Wong" <wonghoi.ee@gmail.com_> wrote in message
news:f3ald6$gg4$1@news.Stanford.EDU...
> For my project, I need to have a client program (MATLAB executable)
> talking to a ser...
Embedded Matlab interface error : error calling MATLAB function 'sf'Hi,
I am using MATLAB 7.6 on a 64-bit machine.
I am trying to run a mathematical model containing various user defined embedded matlab function that was previously 'built and run' using same matlab version but on a 32-bit machine.
I am getting this error on my current machine setup "Embedded Matlab interface error : error calling MATLAB function 'sf'".
I have already visited many matlab central pages yet I am unable to find a solution to this specific problem.
N.B:
I tried to configure a c compiler through mbuilder -seup on caommand line but it seems that there...
starting matlab gui outside matlabHello!
I have to start my matlab gui outside matlab program (without opening
it). Is there something like .bat file in Java for Matlab?
Thanks for helping me out...
:)
Emma
Hi Emma,
I'm not sure if I understand your question.
One way would be to compile the GUI (there is a lot of stuff on that
in this forum).
Otherwise, if you just want to avoid opening Matlab and loading the
file, you can use:
1) a simple .bat file with the following command:
matlab -minimize -yourfile.m
2) a shortcut with this line as target (but with the full matlab.exe
path), in which you also specify your gui dire...