Performance of matlab function build and called by C# application
3 views (last 30 days)
Show older comments
Dear all, I wrote the following matlab function (R2011b):
function y = makesquare(x)
y = magic(x);
end
Now I'm doing some tests with Builder NE to check performances using ML code in C# 2010 with .NET Framework 4.0.
in C# I have written the interface:
public interface IClasse1CS
{
void makesquare(int x, out double[,] y);
}
and the code (snipped) to use the ML code via C# Interface (or native classes)
using MathWorks.MATLAB.NET.Arrays;
using MathWorks.MATLAB.NET.Utility;
using MyNameSpace;
IClasse1CS c = new MechanismIClasse1CS();
for (int i = 0; i < 10000; i++)
{
c.makesquare(1, out output);
}
the same loop (10000 times) takes about 0.24 secs to execute on MatLab, while takes about 2.6 seconds to run on C#. Is this by design or should it be optimized? If these are the performance I'll can't use NE to integrate ML code in my C# code, performance must be similar between C# and ML.
thanks
0 Comments
Answers (0)
See Also
Categories
Find more on .NET Client Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!