mex

Correctly over-loading a stringbuf to replace cout in a MATLAB mex file

MathWorks currently doesn't allow you to use cout from a mex file when the MATLAB desktop is open because they have redirected stdout. Their current workaround is providing a function, mexPrintf, that they request you use instead. After googling around a bit, I think that it's possible to extend the std::stringbuf class to do what I ne...

Problem using Mex

My application uses both NetTcpBinding and BasicHttpBinding but each of them will expose a subset of my service class. I have created the service as below. The problem is that even though I just added 3 of my contracts to the Mex binding, all of the contracts are shown when I want to add the service to my project. m_ServiceHost = new ...

Why WCF class Binding doesn't have member ReaderQuotas?

I'm wondering why the class Binding in WCF doesn't have a property ReaderQuotas, while its subclasses BasicHttpBinding and WSHttpBinding does. This fact makes coding a little hard. For me, I use below code to extract binding information from MEX endpoint URI. However, it just got Binding. If I want to change ReaderQuotas of the binding,...

How to add "help"-text to a mex-function?

I am writing a Matlab mex-file. However, mex-files seem to have a serious limitation: help mexfilename won't cause a help text to appear. I could circumvent this by writing a m-file, that ultimately calls the mex-file, but includes help, but there has to be a better way. On the other side, that way I could do all the error-checking in ...

How do you write to a buffer then to a file

I'm trying to write some STL data out of matlab and I'm trying to do this by writing a MEX File (a matlab DLL written in C) At the moment I have a loop just going through my data writing out the stl syntax with the floats. ... for(m=0;m<colLen;m++) { res = m % 3; if(res == 0) { fprintf(fp, "\tfacet normal %f %f ...

adding custom SOAP headers in MEX response for operation contract based WCF services

I'm having a problem consuming WCF service requiring custom SOAP headers for methods marked with [OperationContract] attributes. Custom headers cannot be explicitly declared in the service because interface methods are not based on [MessageContract]. As a result When svcutil.exe tries to build client proxies the resulting generated code ...

WCF Mex End Points for Multiple Bindings

Hi, I'm building a WCF service that will expose BasicHttp and NetTcp bindings. I've also added two corresponding Mex endpoints, i.e. <service name="WCFTest.CalculatorService" behaviorConfiguration="WCFTest.CalculatorBehavior"> <host> <baseAddresses> <add baseAddress = "http://localhost:8000/WCFTest/CalculatorService...

running old mex file on new matlab releases

I'm trying to run a program originally tested on Matlab 6.5 on a new release (R2009a) The program uses some mex files, and I get the following error when trying to run it: ??? Invalid MEX-file '/normalizedCut/common_files/sparsifyc.mexglx': normalizedCut/common_files/sparsifyc.mexglx: symbol mxGetIr, version libmx.INTERNAL not defined i...

Can IIS-hosted WCF service be configured for BOTH Windows Auth and Anonymous?

I've got a small WCF webservice working with the built-in WCF Service Host and with hosting by the Visual Studio 2008 built-in development webserver. I these hosting enviroments I have relied on the WCF Test Client for invoking the service methods. Now I am running into problems with my next phase of testing: I have it hosted in IIS...

mex binding error in WCF

Hello everyone, I am using VSTS 2008 + C# + .Net 3.0. I am using self-hosted WCF. When executing the following statement, there is the following binding not found error. I have posted my whole app.config file, any ideas what is wrong? ServiceHost host = new ServiceHost(typeof(MyWCFService)); Error message, Could not find a base addr...

MATLAB MEX interface to a class object with multiple functions

I am using the MEX interface to run C++ code in MATLAB. I would like to add several functions to MATLAB for handling a System object: sysInit() sysRefresh() sysSetAttribute(name, value) String = sysGetAttribute(value) sysExit() Since each MEX dll can contain one function, I need to find a way to store the pointer to the global System ...

my wcf services only show directory listing and no wsdl

I have a few wcf services created a number of ways. all of them only display the directory listing when i browse to them. (I fixed the part about authentication) Also I have very nice mex settings for all of them as well. it seems to me that there should be a file in the service location to browse to? its especially annoying that I ...

Profiling a mex-function

I have just rewritten a Matlab program in c++ as a mex-function to speed things up, with fantastic results. This optimization decision was a very very good idea, with up to a factor 20 speed up without threading. It still left me curious about what the mex-function was spending time on and wanting to identify possible bottlenecks. I'm ...

Can a WCF service w/ BasicHttpBinding without a MEX Endpoint be exploited by absolute strangers?

From what I understand: If you don't have a MEX endpoint / WSDL, your service is basically non-discoverable. Only people who have knowledge of your data contract should be able to consume your service. Does this assertion hold water, or are there ways for malicious denizens of the internet to figure out how to invoke/consume services th...

MATLAB: DLL loaded by mex would not unload?

I have a mex module called p.mexw64 which uses another dll called p.dll The mex module loads p.dll when it is loaded since it is linking to it's lib file. Normally, when I want to recompile p.dll I do clear p;. This unloads p.mexw64 and then in turn also unloads p.dll. Except when it doesn't. In some scenario which I can't really quan...

embed python in matlab mex file on os x

I'm trying to embed Python into a MATLAB mex function on OS X. I've seen references that this can be done (eg here) but I can't find any OS X specific information. So far I can successfully build an embedded Python (so my linker flags must be OK) and I can also build example mex files without any trouble and with the default options: jm...

Matlab: avoiding memory allocation in mex

I'm trying to make my mex library avoid all memory allocation what so even. Until now, the mex got an input, created some matrices using mxCreate...() and returned this output. But now I'd like to modify this interface so that the mex itself would not do any allocations. What I had in mind is that the mexFunction will get as input the ma...

How do I create an N-D matrix of doubles in a MATLAB MEX file?

I need to make a 3-D matrix in a MEX file. In the API reference, there is mention of mxCreateCellArray for N-D cell arrays, mxCreateStructArray for structs, etc. But there is no mxCreateDoubleArray mentioned. Is this possible? ...

Compiled MATLAB: Why does my application hang at the end?

I'm using MATLAB's deployment tool to compile a simple project which uses a mex library. The executable runs OK and does what it's supposed to do except that when it's supposed to finish, nothing happens. It just sits there. When I'm compiling any other project, for instance the magic square example from the docs, it works OK. The execu...

safe, fast CFLAGS for mex functions in matlab

I am converting a number of low-level operations from native matlab code into C/mex code, with great speedups. (These low-level operations can be done vectorized in .m code, but I think I get memory hits b/c of large data. whatever.) I have noticed that compiling the mex code with different CFLAGS can cause mild improvements. For exampl...