Using NET assembly from within MATLAB

Hi, I am trying to pass a cell array containing strings and doubles to a NET method that takes a System.Object array as input but get an error. According to the documentation, http://www.mathworks.com/help/techdoc/matlab_external/brpb5o9-1.html#bs20zhq, this should be possible.
Any ideas?
Regards
----------------- Full details: ----------------
-----C# code
namespace BulkUploadUtility
{
public static class BulkUpload
{
public static System.Object[] Data;
public static void UploadData(System.Object[] data)
{
Data = data;
}
}
}
----MATLAB
asm = NET.addAssembly('BulkUploadUtility.dll');
a= {'a','1';'b','2'};
BulkUploadUtility.BulkUpload.UploadData(a)
gives the error: ??? No method 'UploadData' with matching signature found for class 'BulkUploadUtility.BulkUpload'.

 채택된 답변

Titus Edelhofer
Titus Edelhofer 2012년 6월 15일

0 개 추천

Hi,
I'm not sure, but as a first simple test to rule this out, try to send a 1D array: you are sending a 2D array to a 1D (System.Object[]) array. Does it work for
a = {'a' '1' 'b' '2'};
?
Titus

댓글 수: 4

Conrad
Conrad 2012년 6월 15일
Hi Titus, thank you for your answer. Tested both cases:
1) a = {'a' '1' 'b' '2'}; to Object[]
2) a = {'a' '1' 'b' '2' ; 'a' '1' 'b' '2'}; to Object[,]
and unfortunately it does not work.
I decided to go with a workaround solution; rather that passing a cell input, I have two input parameters: array of strings and an array of doubles.
Thanks again
Conrad
Titus Edelhofer
Titus Edelhofer 2012년 6월 15일
Hmm, o.k.. By the way: you are using R2011b or R2012a? Because passing cell arrays did not work before ...
Conrad
Conrad 2012년 6월 15일
That is it then....was testing on a machine with R2010b. Will test using R2012a and give feedback.
Thanks!
Conrad
Titus Edelhofer
Titus Edelhofer 2012년 6월 16일
If you like you might mark the question as answered ...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

태그

Community Treasure Hunt

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

Start Hunting!

Translated by