Thread Subject: How to pass C# object or data to Dll made from Matlab

Subject: How to pass C# object or data to Dll made from Matlab

From: Chang shen

Date: 14 Jan, 2009 19:56:02

Message: 1 of 1

Hi All, greeting!

If I have a C# object or data. For example in C#


Bitmap img = new Bitmap();
double[,] data = new double[100,100];


How to pass img and data to a Dll made from Matlab M file?


function object_handle = GetObjectFromCSharp(object)
   ....
   %Do something with object then return the object handle so C#
   %calling code can use.
   ....
end

A practical case is Bitmap image:

in C#:

Bitmap img = Bitmap(filename);
Bitmap new_img = MatlabDll.ProcessBitmap(img);

Where ProcessBitmap() is a function.

function out = ProcessBitmap(data)
    .....
    out = DoSomething(data);
   .....
end


The key is not passing filename to MatlabDll but data object or handle or pointer/reference (for C/C++).

Thanks in advance.
Chang

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
c csharp c c da... C Shen 14 Jan, 2009 15:00:21
rssFeed for this Thread

Contact us at files@mathworks.com