MATLAB SDK .NET Using a Matlab Class array as an output
3 views (last 30 days)
Show older comments
Hi
I am trying to return an array of custom objects (from a matlab class definition) in a function that I am compiling into a .NET dll. If I call the function from Matlab, I get back what I expect an array in which each element is an object containing a set of properties I have defined
Example:
function [ output ] = Test( inputarg1, inputarg2)
o(1,2) = MyClass();
o(1,1).PropA = 'Hello';
o(1,1).PropB = 'Hi';
o(1,1).PropC = 1.45;
o(1,2).PropA = 'Hello again';
o(1,2).PropB = 'Hi again';
o(1,2).PropC = 3.65;
output = o;
end
Once I have compiled this into a dll using the Library compiler (and I see it states under "Files Required for your library to run" that the class definition is listed) and I call the function, it just returns null as the MWArray output.
How do I use custom matlab classes as outputs in compiled .net dlls?
Am i missing something when i am compiling?
0 Comments
Answers (1)
Varun Bhaskar
on 13 Aug 2015
Hello,
.NET does not have any built-in data type that corresponds to the MATLAB specific structure and cell types. The MWArray API offers the datatype handling capabilities mentioned in the link below:
The workaround would be to make MATLAB functions return the supported types above and compile these functions into a .NET Assembly.
0 Comments
See Also
Categories
Find more on Deploy to .NET Applications Using MWArray API 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!