从 .NET 调用 MATLAB
编写可用于 MATLAB® 的 .NET 程序
MATLAB Engine API for .NET 提供 .NET 编程语言和 MATLAB 之间的接口。此 API 使程序能够启动 MATLAB、计算带参量的 MATLAB 函数,并在 MATLAB 和 .NET 程序之间交换数据。
要直接从 MATLAB 访问 .NET 库,请参阅从 MATLAB 调用 .NET。
如果您需要维护为 MATLAB R2022a 或更早版本创建的现有 .NET 程序,并且这些程序使用 Microsoft® 组件对象模型 (COM),请参阅编写适用于 MATLAB 的 COM 应用程序。
函数
类
主题
设置和编译引擎应用程序
- Elements of a .NET Engine Program
Get started with MATLAB Engine API for .NET.
从 .NET 应用程序启动 MATLAB
- Start MATLAB Session from .NET
Start a .NET engine session synchronously or asynchronously, and pass startup options to MATLAB. - Connect .NET Application to Running MATLAB Session
Connect the .NET engine to a running MATLAB session that has been started as or converted to a shared session.
数据映射
- Pass .NET Data Types to MATLAB Functions
Convert .NET data to MATLAB data. - Handle MATLAB Data in .NET Applications
Convert MATLAB data to .NET data. - Strongly Typed Interface for C#
A strongly typed interface enforces a strict data type mapping between MATLAB and C# to use in .NET applications.
从 .NET 调用 MATLAB 函数
- Execute MATLAB Functions from .NET
Pass variables to MATLAB function calls and return values to .NET applications. - Use MATLAB Structures in .NET
Define MATLAB structure data types in .NET using theMathWorks.MATLAB.Types.MATLABStruct
class. - Use MATLAB Dictionary Objects in .NET
These examples show how to pass dictionary variables to MATLAB function calls and return dictionary values to .NET applications. - Use MATLAB Handle Classes in C#
Integrate MATLAB handle classes with C# applications.
疑难解答
MathWorks.MATLAB.Exceptions Exception Classes for .NET
The MathWorks.MATLAB.Exceptions
namespace contains the
exception classes for the .NET engine.