주요 콘텐츠

C에서 MATLAB 호출하기

mxArray를 사용하여 C 프로그램에서 MATLAB® 코드 실행

엔진 애플리케이션은 MATLAB을 계산 엔진으로 사용하여 사용자 자신의 C/C++ 프로그램에서 MATLAB을 호출할 수 있게 해 주는 프로그램입니다. C 엔진 애플리케이션을 빌드하려면 mex 함수를 호출하십시오.

참고

C용 Engine API보다 C++용 MATLAB Engine API를 사용하는 것이 좋습니다. C++용 MATLAB Engine API는 엔진 애플리케이션을 작성하기 위한 최신 C++ 기능을 포함합니다. 자세한 내용은 C++에서 MATLAB 호출하기 항목을 참조하십시오. C용 Engine API를 제거할 계획은 없습니다.

엔진 애플리케이션을 사용하려면 MATLAB이 설치되어 있어야 합니다. MATLAB Runtime만 설치된 컴퓨터에서는 MATLAB 엔진을 실행할 수 없습니다.

C 엔진 애플리케이션을 빌드하기 위한 전제 조건은 다음과 같습니다.

  • C 소스 코드를 작성해 본 경험. C용 Engine API와 C Matrix API 함수를 사용하여 C 소스 코드 파일을 만들 수 있습니다.

  • MATLAB에서 지원하는 컴파일러. 지원되는 컴파일러의 최신 목록을 보려면 지원 및 호환되는 컴파일러를 참조하십시오.

  • -client engine 옵션을 포함하는 mex 빌드 스크립트 사용.

C용 Engine API

EngineMATLAB Engine 유형
engOpenMATLAB Engine 세션 시작
engOpenSingleUseStart MATLAB engine session for single, nonshared use
engCloseMATLAB Engine 세션 종료
engEvalStringEvaluate expression in string
engGetVariableCopy variable from MATLAB engine workspace
engPutVariablePut variable into MATLAB engine workspace
engGetVisibleDetermine visibility of MATLAB engine session
engSetVisibleShow or hide MATLAB engine session
engOutputBufferSpecify buffer for MATLAB output

도움말 항목

요구 사항

엔진 애플리케이션 작성

엔진 애플리케이션 빌드하고 실행하기

문제 해결

MATLAB Engine을 시작할 수 없음

MATLAB Engine이 실행되지 않을 때 수행할 작업.

Debug MATLAB Function Called by C Engine

How to verify MATLAB functions used in engine applications.

User Input Not Supported

Some MATLAB functions that interact with the user are not supported in engine applications.

Multithreaded Applications

MATLAB libraries are not thread-safe.