フィルターのクリア

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 Center および File ExchangeCall 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