작업 1. Mbuild
>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications:
Would you like mbuild to locate installed compilers [y]/n? n
% n을 입력한다. y를 입력하면 lcc 컴파일러로 설정할 수 있다.
Select a compiler:
[1] Microsoft Visual C++ 2005 SP1
[2] Microsoft Visual C++ 2008 Express
[3] Microsoft Visual C++ 2008 SP1
[0] None
Compiler: 3
% 설치되어 있는 컴파일러를 선택한다.
The default location for Microsoft Visual C++ 2008 SP1 compilers is C:\Program Files (x86)\Microsoft Visual Studio 9.0,
but that directory does not exist on this machine.
Use C:\Program Files (x86)\Microsoft Visual Studio 9.0 anyway [y]/n? y
% y를 입력한 후 엔터를 치거나 그냥 엔터를 치면 승인이 된다.
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 SP1
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n? y
% y를 입력한 후 엔터를 치거나 그냥 엔터를 치면 승인이 된다.
****************************************************************************
Warning: Applications/components generated using Microsoft Visual Studio
2008 require that the Microsoft Visual Studio 2008 run-time
libraries be available on the computer used for deployment.
To redistribute your applications/components, be sure that the
deployment machine has these run-time libraries.
****************************************************************************
Trying to update options file: C:\Users\mwave\AppData\Roaming\MathWorks\MATLAB\R2009b\compopts.bat
From template: C:\Engineer\MATLAB\R2009b\bin\win64\mbuildopts\msvc90compp.bat
Done . . .
% 기본 설정이 완료된다.
작업 2. 예제 만들기(test.m)
function m = test(n)
% function 출력=함수명(입력)
% 입력 받은 값을 숫자로 변환한다. 기본이 문자인 듯 함.
if ischar(n)
n=str2num(n);
end
% 필요한 연산을 수행 한다.
m = 2^n
작업 3. 컴파일 하기
>>mcc -m test.m
test.m이 있는 작업 공간에 test.exe가 만들어진다.
실행.
test(3)
m =
8
만들어진 실행파일을 다른 컴퓨터에서 실행하려 한다면 MCRRINSTALLER.EXE 설치하여야 한다. 이 파일이 있는 곳은 다음과 같다.
32비트인 경우 : 설치경로\MATLAB\R2009b\toolbox\compiler\deploy\win32
64비트인 경우 : 설치경로\MATLAB\R2009b\toolbox\compiler\deploy\win64
Reference
1. http://www-rohan.sdsu.edu/doc/matlab/toolbox/compiler/mcc.html
'Programming > Matlab, Octave, Scilab' 카테고리의 다른 글
[Matlab] 항공기 계기를 GUI에서 동작시켜보자... (0) | 2010.05.01 |
---|---|
Ballard Tech.사의 ARINC429 Card (0) | 2010.05.01 |
[Matlab] C/C++의 함수 및 기능을 Matlab으로.. [2] (0) | 2010.05.01 |
[Matlab] C/C++의 함수 및 기능을 Matlab으로.. [1] (0) | 2010.05.01 |
[Matlab] Serial Port Control (0) | 2010.05.01 |
댓글