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. I have the following setup: 1) a function of several variables implemented in MATLAB which I want to optimize, i.e. to find variable values for which the function gives minimal value, 2) a very good local optimization procedure implemented in C which I want to use repeatedly to optimize the above mentioned function, and 3) a procedure for generating the local search starting points implemented in MATLAB again. Thus, I need to run a MATLAB function which will iteratively generate a starting point and run a C-function local search procedure from that point. I must pass a function de...

I have a subroutine which draws arcs, I call it like this: arc( $from, $to, $col, $alist, $trim, $shift, $npoints ); and it draws an arc from $from to $to, with various adornments specified by the other arguments. I have a subroutine sub add { my ( $p, $q ) = @_; my ( $x, $y ) = @$p; my ( $dx, $dy ) = @$q; return [ $x+$dx, $y+$dy ]; } which receives a point [$x,$y] and a displacement [$dx,$dy] and returns the displaced point [$x+$dx,$y+$dy]. I have a subroutine polyarc, which I call like this my $displist = [ [0,0], [$u,-$u], [-$u,$u] ]; polyarc( $d...

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

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

I have created a Simulink model to test a Kalman filter that I designed and to replicate real data input, I am using an embedded Matlab file that calls a function within this file called "myWait". I placed this function at the end of my embedded Matlab file and it does not seem to have any problems calling this function, but within this function, it makes use of predefined functions "timer", "start" and "wait". When I try to build the model I get the following errors: Undefined function or variable 'start'. Function 'Real Time States...

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

Hi, I am trying to write an application in Simulink using S-Functions written in C language. I would like to know if I could call Matlab Array functions like 'var', 'median' etc from the S-Functions written in C. i.e., Is there a C interface for the Matlab functions? Any response would be appreciated. Thanks Pradeep. Pradeep wrote: > Hi, > > I am trying to write an application in Simulink using S-Functions > written in C language. I would like to know if I could call Matlab > Array functions like 'var', 'median' etc from the S-Functi...

Lets say I have a function g(p,x) where x and p are of some defined type. I also have a function NewtonR which I can use like so: x = NewtonR(g,p,x0) There is also another function I want to call ImplicitTrap which can be done as: u = ImplicitTrap(g,p,u0,step,n) This function defines a function of g, and it is this function that I'd like to pass to NewtonR. Can it be done? Basically the code is implementing the implicit trapezoidal rule for numerical integration with the NR solver being used at each step with automatic differentiation being used to handle the differentiation. M...

If someone can help me here , it will be greatly appreciated ... I was able to set up the Matlab Engine Call via C properly without any issues.. , done it via a C function calll .. something like this ... : ////////////////////////////////////////////////// #include <math.h> ..... int matlab_call(double Amp) { Engine *ep; mxArray *A = NULL, *result = NULL; if (!(ep = engOpen(""))) { fprintf(stderr, "\nCan't start MATLAB engine\n"); return EXIT_FAILURE; } ... } ////////////////////////////////////////////////// Now i want to...

How do I pass a function as an argument to another function that then uses the argument as a function name to defadvice? Here's what I'd like to do: (defun work-around (arg-function) (defadvice arg-function (around work-around-fn activate) ... before code ... ad-do-it ... after code ... ) ) (work-around 'some-function) However, I can't seem to get some-function into the defadvice call as the function argument. 'arg-function doesn't work either. With the current version, the advice binds to arg-function, not some- function. When I change it to 'a...

I'd like to write a function like: function f(){ ... bla ...} f_example(f); function f_example($function_to_execute) {...bla... $function_to_execute() ...bla....} AND how to pass the variable of the function : function f_example($function_to_execute($var1,$var2)) {...bla... $function_to_execute() ...bla....} Thank you in advance for the time you'll spend for me, Andrea. I'm sorry, I don't quite understand what you are asking... If you are asking how to use results of a function in another function then you should do this. function test1() { return "Hello Wor...

I am using Matlab r2015a on windows 10. so, how to fiz this? On 03/21/2015 4:09 AM, Altin Guberi wrote: > I am using Matlab r2015a on windows 10. so, how to fiz this? Do what it says, rename the m-file you created (or got from somewhere else) to some name that doesn't conflict. -- ...

Hi all, I have a MEX function written in C, let's call it Afunc.cpp, and I have another Matlab function called Bfunc.m (it is not from the Mathworks, so it is not the pre-defined Matlab function) Is it possible to call this Bfunc.m from within Afunc.cpp? It is because the Bfunc.m is too complicated and it used a lot Matlab predefined function which I don't how to rewrite in C/Cpp. So a simpler way for me is to let Afunc.cpp call Bfunc.m... How to do that? Thanks a lot! Mike wrote: > Hi all, > > I have a MEX function written in C, let's call it Afunc.cpp, >...

This article is within the scope of WikiProject Mathematics , a collaborative effort to improve the coverage of Mathematics on Wikipedia. If ...

(credit: Texas A&M University ) Standing desks—most often installed in efforts to improve physical activity and health—may help get your noggin ...

Drop Point Knives: Function, Fit, Timeless

... roles and create a squad, and the creator can name, lock, or invite others to their little group. The more an outfit fills up, the more functions ...

One of the first issues I faced when learning F# was finding out how to specify multiple parameters to a function. While this might sound obvious ...

I’m a klutz. My phone has the scars and cracks to prove it. Likewise, my laptop bears scratches and dents in the lid, from me banging it into ...

... going to tell you about our processing architecture as well as at a recent performance improvement with the integration of AWS Lambda functions. ...

... to flow faster and more easily when I know I only have a couple of hours to turn it in. Entrepreneur Dan Martell calls this a “forcing function” ...

With Creative Kit, Macphun wants to pick up where Apple’s now-defunct Aperture left off. As a plug-in to Photos , Macphun’s apps significantly ...

MICROSOFT PRESS publishes on Microsoft tools & technologies, plus programming best practices. Our blog offers book info, links to ebooks, & other ...

Resources last updated: 2/4/2016 7:59:30 PM