This works .. thanks James

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

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

Hello, 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 platform . Thanks in advance, Nicolas On 10-12-03 01:22 AM, Nicolas wrote: > 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 platform . It appears there is a parsing problem in the script that invokes Matlab. Here's an example of what I had to do to get around it: !matlab -r \""...

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

Hi I have a function Z = func(V,W) %function Z = func(V,W) Z = zeros(size(W)); <iterate through V and W and use the values V(i,j) and W(i,j) to assign a value to Z(i,j)> %end func I use 'func' in a while loop with many iterations. In every iteration Z(i,j) needs to be 'clean', ie. have only zeros before the calculations are performed on it in the function : <state V,W> while <Z does not satisfy a condition> Z = func(V,W); ..... ....some other calculations end; According to theory, the command 'Z=zeros(size(W))' inside the function will be is...

I downloaded the MS visual C++ 2008 Express Edition and the SDK as detailed in http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/?solution=1-6IJJ3L My embedded function didnt work at the beginning because I did "mex -setup" before I installed my SDK. But after I installed the SDK, I ran "mex -setup" in Matlab once again and choose the MS visual C++2008 as my compiler. Then, my embedded matlab function worked. Thanks to the contribution from above! ...

I am trying to create an exe from a matlab function which doubles the number you give it. matlab function: test.m function [output] = test (number) %return double the input number output = 2*number; disp(output); run matlab compiler at command line with: mcc -mv test.m with the resulting exe: test.exe However when I run it at DOS prompt: test 1 I am returned a value of 98. I thought that maybe this was some octal description of the output, but 98 oct is not 2 decimal. Some other results it returned: C:\Documents and Settings\alex\Desktop\lighttrans\Frank Work \test...

Hi, I have a c++ application which uses Matlab engine to save data for further use with Matlab. I need to distribute the application to users that do not have Matlab. Is there a way tp use Matlab Engine with Matlab Runtime Component ? How should I change the compilation to do it ? Thanks, Ofra ...

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

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

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

Hi, I have a MATLAB Component Runtime installation for Matlab v7.2. 1) I want to know if this installation contains Matlab Engine? 2) Or do I need the complete package that contains Matlab IDE also. 3) In this installation it does not have Matlab.exe. 4) Now I want to use API calls available in Matlab to call functions COHERE used to find Coherence and TFE to calculate Transfer function are needed. These functions are available in the MATLAB SP toolbox) The operations required are: 1) I have to call and/or initialize MATLAB from windows form created using C#. 2) Then pass the two array...

I have the following problem. I have created a simple Matlab GUI (for our purposes it can just be considered a Matlab function) which gathers some parameters and then invokes a perl script that in turn calls other perl and Matlab scripts to perform various calculations. If instead of using the Matlab GUI, I run the perl command from the unix prompt, the flow runs and concludes correctly. BUT if I invoke the flow from the Matlab GUI (function), then it runs correctly by calling various other perl and Matlab scripts, but then when it reaches the third Matlab function call, it consistently stalls...

So this might be more a bash question, but I am trying to run matlab in XP, once per execution of a function (because I need to use a commercial function which is buggy and crashes if I use it more than once within a session). I start cygwin and I do for ((d=0;d<5;d++)); do echo $d; matlab -nojvm -r script; done and that works fine. But I would like to pass filenames, so I try something like for d in 'ls *.nse'; matlab -nojvm -r my_function \( $d \); done and the "d" argument is not passed to my_function. What am I doing wrong? TIA! ...

Hi all, I want to create a fortran program which makes use of the Matlab engine to perform some calculations. To do this I've made a module which holds the interfaces to the Matlab engine functions I need. For some functions, I need to pass a string as argument, but this shows some behaviour I don't understand. When I pass a string to the function, either as a literal constant, or through a named variable, it doesn't work (the function returns 1, indicating it failed). When I turn the string into an array of characters, again it doesn't work, unless (and this is the st...

Hi, I have written a gui using matlab. What I would like is a desktop-shortcut to open matlab and start the gui/m-file automatically. Is it possible to startup this gui from e.g. a dos-prompt-shortcut AND to pass a matlab command along with it? Thanks for any info. joris wrote: > Hi, > > I have written a gui using matlab. What I would like is a > desktop-shortcut to open matlab and start the gui/m-file > automatically. > > Is it possible to startup this gui from e.g. a dos-prompt-shortcut AND > to pass a matlab command along with it? > > Thanks for...

I am new to using mcc, mbuild, and mex - I'm attempting to use these to compile a function in matlab into a dll or exe so that I can re-use it in Matlab just as if it was still an m file. First, I wanted to verify that the code works, and I have received a demo license of the Matlab Compiler to test. As a simple example I've written the following function: function [output_var] = this_is_a_test(input_var) output_var = input_var*2; return I've tried multiple combinations of the mcc call in attempts to compile this function, some compile, some don't. First I tried this call: m...

hallo firends, Can any body help me write this below code into MATLAB object oriented code or C code form please? M=50; % total number of periods. (choose for 1s duration) f0 = 50; % fundamental AC frequency T0 = 1/f0; %fundamental AC period T = M*T0; %Time for M periods (integer M) N=30; % sample points per period. dt = T0/N; % Sample at N points per period (integer N > 20) t = dt*[1:M*N-1]; % Sampling time array A0=120/2; % amplitude of AC signal. Divide by 2 or maybe sqrt (2) ? AC=A0*sin(f0*t*2*pi); % create AC signal. DC0=50; % DC amplitude DC=DC0*ones(1,length(t)); % create a DC signal that is constant of length t S=AC+DC; % total signal is AC signal + DC signal figure(1); plot(t,S); % plot signal. xlabel('time');ylabel('Signal'); title('Total Signal'); % filter components fAC=S-mean(S); % here is the AC component fDC=mean(S); % here is the DC component figure(2); plot(t,fAC,'r',t,fDC,'b'); % plot AC and DC signals legend('AC','DC'); xlabel('time');ylabel('Signal'); title('Signal with only AC component'); figure(3); plot(t,fDC,'b'); % plot DC signal legend('DC'); xlabel('time');ylabel('Signal'); title('Signal with only DC component'); figure(4); % best to plot in Fourier domain u=abs(fftshift(fft(S))); NumPoints=length(t); freq=(1/dt)*[1:NumPoints]/NumPoints; % create frequency axis freq=fre...

Hi, i'm executing Matlab scripts from my C++ application using Matlab engine. my problem is with putting breakpoint in the Matlab script. when i put a breakpoint in the script, the program indeed stops at the breakpoint, but everything is stuck, and it is impposible to proceed executing the program (C++ and the Matlab script) Regards, Moish Frankel GSM modems and Signal Processing Texas Instruments moish@ti.com ...

Does any body still remember the command to print out the matlab build-in functions? for example, how could I pull out the script for sqrt.m file? and similarly, the scripts for the simulink blocks? Thanks in advance. Cindy Cindy Li wrote: > Does any body still remember the command to print out the matlab build-in > functions? for example, how could I pull out the script for sqrt.m file? > and similarly, the scripts for the simulink blocks? >> type sqrt.m %SQRT Square root. % SQRT(X) is the square root of the elements of X. Complex % results are produced if X is not...

I'm trying to create an object inside C++ and then pass it to Matlab via en= gPutVariable. It seems I can create a struct // Create a float array mxArray *acq_data =3D mxCreateNumericMatrix(0, 0, mxSINGLE_CLASS); float *data =3D (float *)mxCalloc(M*N, sizeof(float)); mxSetData(acq_data, data); mxSetM(acq_data, M); mxSetN(acq_data, N); // Convert to struct const char *fieldname =3D "data"; mxArray *acq_struct =3D mxCreateStructMatrix(1,1,1, &fieldname); mxSetField(acq_struct,i,"data",acq_data); // Convert to class ?? Does it work? if (j=3D=3D1...

Hi guys I am now experencing a great difficulty in the interation between java and matlab. I have an objective function written in JAVA with has method return an numerical number, i call it 'profit'. The nature of this obtive function (ObjFun.java) is that it takes an parameter input, say C, with different C value, the returned profit value is different. Eventually I want to find the optimized C value which produce the maximun profit (C will be under constrains). Initially I want to use linprog or fminsearch in matlab. So I tried the command in matlab that excutes my ObjFun.java. But it failed because my ObjFun.java will call an external .exe file. and the file path contains spaces which is fine by Java but not matlab. I stuck here, I myself is a Java programmer not good at matlab, I can't find any thing on google about the solution to my problem. So here I propose another idea: call matlab function in JAVA. I need some advise on this. Thank you very much for a reply!!! Lemon can anyone give advice?? "Lemon F" <f.lemon.jin@hotmail.com> wrote in message <i3bag7$i96$1@fred.mathworks.com>... > can anyone give advice?? If you would not have double-posted you would have seen that you already received advice (on the other post): http://www.mathworks.com/matlabcentral/newsreader/view_thread/288403 ...

Hello 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 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 > > HELP MEX > HELP MEX Or, better, HELP MCC help pcode pseudo code is useful to obfuscate code - protect algorithms, yet still run at full speed and be distributable to other matlab users 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 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...

I'm making an end-user application where I would like to use Matlab functionality both for calculation and plotting. Matlabs GUI builder guide does not satisfy my needs (no support for f.ex. internal frames and other nescessities), so I'm planning to compile my Matlab code and use other API (Java, QT or something) for GUI. My problem is then, that I loose access to the neat plotting commands availible under matlab GUI... Is there a way of integrating Matlabs plot functionality into another GUI system? - has it been done? - I appreciate any response! - P�l Berge ...

Tax protesters in the United States make a number of administrative arguments that the assessment of the federal income tax in the United States ...

A Bandidos bikie has admitted killing a drunken stranger who stumbled across the gang's Brunswick clubhouse and began harassing one of their ...

A Bandidos bikie has admitted killing a drunken stranger who stumbled across the gang's Brunswick clubhouse and began harassing one of their ...

The state's highest court convened Thursday to consider a key question holding up trials in the Freddie Gray case: Can Officer William Porter ...

What are “dormant cyber pathogens” you ask? It’s a sort of computer network infection, according to the U.S. government, which could produce ...

A peek at the general election argument by digby There will be a lot of words but this is it in a nutshell: "We have a big problem at this point, ...

Samsung Electronics Co. called customer privacy “extremely important” and said any requirement to build backdoors into its devices would undermine ...

A slew of tech companies throw their weight behind Apple. Here's the gist of what they're saying.

In what was originally slated to be an hour of oral arguments, the U.S. Supreme Court went 19 minutes overtime Wednesday in the case of a Texas ...

It's possible to make some reasonable and fair points about inequality in the United States. There's more of it than there is in most other rich ...

Resources last updated: 3/10/2016 9:17:45 AM