필터 지우기
필터 지우기

How to convert a .Net array into something Matlab can understand?

조회 수: 2 (최근 30일)
Travis Leith
Travis Leith 2019년 10월 30일
댓글: Travis Leith 2019년 10월 30일
I have managed to write some .net code and compile it to a dll, and call it successfully from Matlab.
The resulting object exposes a number of properties which are all array of string/double/DateTime.
If I do the following in Matlab
z = Library1.DbData.getData(startDt, endDt);
a = cell(z.a_text_field);
Then I can see the results in a no problem.
However, if I do
c = cell(z.dates,'ConvertTypes','System.DateTime');
Then I get
Error using cell
Conversion to double from System.DateTime[] is not possible.
And if I do
d = cell(z.doubles,'ConvertTypes','all');
Then I get
Error using cell
Size inputs must be scalar.
I could hack this and make everything return a stirng, but it seems a bit ugly. How can I make doubles and datetimes work?
  댓글 수: 2
Travis Leith
Travis Leith 2019년 10월 30일
I have answer for the double array. I simply need to do
x = z.some_numeric_field.double;
There doesn't seem to be any equivalent for DateTime though.
Travis Leith
Travis Leith 2019년 10월 30일
Final update: for DateTime I am just returning the Matlab date number instead of a DateTime. Slighlty hacky. Better support for primitave arrays would be nice.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Web Services from MATLAB Using HTTP에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by