use C# lib in MatLab

95 visualizaciones (últimos 30 días)
Roland Thamm
Roland Thamm el 13 de Sept. de 2019
Editada: Jakup Tauser a Lava el 28 de Mzo. de 2024 a las 10:24
How can I use a C# Library with MatLab

Respuestas (1)

Kojiro Saito
Kojiro Saito el 14 de Sept. de 2019
You can call your C# library by loading dll using NET.AddAssembly and call its function.
Here is a simple example in this document.
In this example, NetDocCell.dll is used and it is compiled from NetDocCell.cs described in C# NetDocCell code in this document.
Here is a snippet to call C# dll.
dllPath = fullfile(pwd, 'NetDocCell.dll');
% Load C# dll
asm = NET.addAssembly(dllPath);
% Creat a C# class
graph = NetDocCell.MyGraph;
% Create cell array containing all data
mlData = cell(graph.getNewData);
% Plot the data and label the graph
figure('Name',char(mlData{1}))
plot(double(mlData{2}(2)))
xlabel(char(mlData{2}(1)))
  1 comentario
Jakup Tauser a Lava
Jakup Tauser a Lava el 28 de Mzo. de 2024 a las 10:23
Editada: Jakup Tauser a Lava el 28 de Mzo. de 2024 a las 10:24
Hey
I need to use some c# .dll inside simulink.
Woud the best strategy be to use matlab functions that handle the c# dll inside simulink?
:)

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by