Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET coupled with MATLAB or R?

I'm writing a program in .NET that will need to utilize the statistical and data analysis functions of R or MATLAB. I have used R but am now contemplating moving to MATLAB since it has a .Net compiler while R can only interface via COM objects. Can anyone recommend going either way? I know MATLAB is infinitely more expensive than R (since R is free) but I'm thinking that may translate to an easier development cycle?

like image 802
Peter Avatar asked May 12 '10 15:05

Peter


2 Answers

You've described three approaches: use .NET Builder for Matlab, use Matlab as a COM object, and use R as a COM object. The costs are different for each.

The Matlab .NET Builder lets you create .NET objects, which you can then call directly from .NET. One advantage of this is you can deploy those objects onto machines that don't have Matlab installed by installing the freely redistributable Mathworks MCR on the targets. This will cost you one Matlab license plus the cost of the Matlab .NET Builder. In the comments, Sharpie quotes a total cost of ~$12.8K for this approach, and Richie Cotton quotes ~200 MB for the MCR.

Another approach is to call Matlab as a COM object from your .NET code. There's some documentation for this approach here. This is cheaper for one machine since you don't have to buy .NET builder. But if you want to deploy onto many targets, you'll have to buy Matlab (plus applicable toolboxes) for each, at a cost of ~$2.8K/machine.

I've never used R, but it looks like the latter approach, of calling R as a COM object, is documented here. And of course you can simply deploy R to all your target machines.

I'd guess the last two approaches are equally difficulteasy, so if the routines you need are available in either language, free is a very good price.

like image 59
mtrw Avatar answered Nov 06 '22 11:11

mtrw


Which way to go depends upon the stats routines you want to use. As Sharpie mentioned, the Matlab Stats toolbox isn't anywhere near as complete as R + 2000 packages. (Though there is a fair amount of stats code in the Matlab Central File Exchange.) If you find yourself having to code up low-level stats routines in Matlab, then you've picked the wrong choice.

The Matlab-.NET interface is slick, and a little nicer than R-.NET, so you likely will save a bit of development time with it. In fact, our current workplace set up is R for stand-alone stats analyses, and Matlab for integration with .NET apps.

As for the cost, if your employer is happy to pay for the software, don't worry about it. If you are paying for it yourself, go with R. :)

like image 2
Richie Cotton Avatar answered Nov 06 '22 12:11

Richie Cotton