MATLAB Function to .NET Application Using MATLAB Data API for .NET with complex data structures (OrderedDi​ctionary<D​ateTime, double[]> <=> timetables)

6 ビュー (過去 30 日間)
Andy
Andy 2024 年 10 月 6 日
回答済み: Swastik Sarkar 2024 年 10 月 24 日
How would the below example:
such as:
A) pass a c# OrderedDictionary<date, double[]> to a matlab function (among other parameters, such as doubles & strings) and
B) Convert/Get that dictionary as a timetable in Matlab, on which operations to be made in the matlab function,
C) While returning a double[] array back into the .NET application?
The above usecase would be more useful as a started into a more complex environment involving timetables and c# dictionaries.

回答 (1 件)

Swastik Sarkar
Swastik Sarkar 2024 年 10 月 24 日
Hi @Andy,
Below is an example of how to pass a .NET Dictionary to a MATLAB function. For more information, refer to the following documentation:
Additional guidance on passing dictionaries to MATLAB can be found in the documentation here::
It is important to note that the Date type may not be supported directly. Instead, consider representing dates as strings, as shown below:
d = '2024-10-24'
d = '2024-10-24'
dO = datetime(d)
dO = datetime
24-Oct-2024
To convert the dictionary to a timetable, use the following approach:
timetable(datetime(dict.keys), dict.values(:,1), dict.values(:,2) ... )
Hope this is helpful !

カテゴリ

Help Center および File ExchangeMoney.Net についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by