From MATLAB to C#. C# programm has lags

I created some function in Matlab. This function image grayscale picture from .mat-file.
I have this command in MATLAB.
figure, imshow(Image_uint8);
I created .dll from this function. My small console programm on C# work, but I have big lags when I want to know point and his value of picture. It`s more than some lags.
C#
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Test11.step7();
}
}
}
using MathWorks.MATLAB.NET.Utility;
using MathWorks.MATLAB.NET.Arrays;
using step0;
namespace ConsoleApp1
{
class Test11
{
public static void step7()
{
Class1 ojb = new Class1();
MWArray output1 = ojb.step0();
Console.WriteLine("Output ~\n" + output1);
Console.ReadKey();
}
}
}
MATLAB
function [pname_save] = step0()
[fname_open, pname_open] = uigetfile('*.asd','Select the .asd file');
if fname_open ~=0
fullname = strcat(pname_open,fname_open);
cd (pname_open);
else
fullname = null;
end
...
figure, imshow(Image_uint8)
%save file
result = regexprep(fname_open, '\.[^\.]*$', '');
pname_save = [pname_open name_out];
cd (pname_save);
...
fclose (fid);
end

Answers (0)

Asked:

on 5 Jun 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!