매트랩 소스파일(m file)에서 실행파일(exe) 만들기

1. MATLAB Compiler 준비 (MATLAB 설치 CD에 보면 설치 옵션으로 있음)

2. 매트랩 command window에서
    >> mbuild –setup  %적당한 C컴파일러를 고른다
    >> mcc –m hoho.m %hoho.m 파일을 exe 파일로 만든다
    %주의할 사항 : script M-file은 exe파일로 만들 수 없다. 반드시 function 형태의 m파일 로 만들 것!
참고 : http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/index.html?/access/helpdesk/help/toolbox/compiler/f13-1003481.html

3. 만들어진 exe파일을 매트랩이 없는 다른 컴퓨터에서 실행하기 위해서는
hoho.exe 파일과 hoho.ctf 파일 그리고 MCRInstaller.exe 파일이 필요하다. MCRInstaller.exe 파일은 c:\MATLAB701\toolbox\compilter\deploy\win32 폴더에 위치해 있다.
다른 컴퓨터에서 MCRInstaller.exe 파일을 이용하여 MATLAB Component Runtime을 먼저 설치한 다음, exe 파일을 실행하면 된다.

참고 사이트 :
http://tiger.la.asu.edu/Matlab/compiler.htm
http://scv.bu.edu/tutorials/MATLAB/compiler/compiler4.html

* 버그 해결
실행파일을 실행하면
"Undefined command/function 'set_param'.
Error in ==> matlabrc at 81" 이라는 메시지와 함께

This application has requested the Runtime to terminate it in an unusual way. Please contact the applications's support team for more information.

위와 같은 메시지 창이 뜨는 경우가 있다.
이는 MATLAB Compilter 4.0(R14)의 버그로써, 시작-제어판-국가 및 언어 옵션에서 지역 설정을 English(US)로 바꾸면 된다고 하는데 한글 윈도우에서는 안 되는듯 -_-;;
그냥 R14SP1이후 버전의 MATLAB Compilter를 설치하는 것이 좋을 듯 합니다 ;;
참고 :  http://www.mathworks.com/support/solutions/data/1-22FK61.html?product=CO&solution=1-22FK61


댓글

Designed by JB FACTORY