Вопрос

Am Newbie to Matlab. Am trying to build online image compression tool using matlab and asp.net. I have written image compression algorithm using matlab and it is working fine and I have deployed it using ".NET Assembly". Then it generates *.dll files. I have included those files in ASP.NET Project -> References -> *.dll. In ASP.NET I have provided option to browse to upload the image. I am saving that image in one folder. I have created an object for dll and calling compression function by passing saved image path. But am getting error like I need to pass MWArray.

code for compression.m:

function compression(img)
imread(img)
compression logic goes here
end 

dll file name is compression_tool and class is CompressionTool

code for online.aspx.cs

path="images/sample.jpg"
compression_tool.CompressionTool obj = new compression_tool.CompressionTool();
obj.compression(path);

Am not getting how to do. Please help me.Thanks in Advance.

Это было полезно?

Решение

When you invoke a method from the assembly generated by Builder NE, you can pass most native .NET type directly which will map to the equivalent MATLAB type.

If for some reason this not working for you, you can explicitly create an instance of one of the derived MWArray classes that wrap internal MATLAB types.

For example:

string name = "Amro";
obj.greet(name);

Assuming obj.greet is the interface for a compiled MATLAB function that receives a string. Otherwise you can explicitly write:

obj.greet(new MWCharArray(name));
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top