MATLAB SDK .NET Using a Matlab Class array as an output
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Varun Bhaskar
2015년 8월 13일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!