1. m code를 작성합니다.
아래는 Gaussian Function의 그래프를 보는 간단한 예제 코드입니다.
function Gauss
x=0:0.1:10;
y=gaussmf(x,[2 5]);
plot(x,y)
xlabel('gaussmf, P=[2 5]')
이 코드를 Gauss.m이라는 화일명으로 저장합니다.
2. 컴파일러를 셋팅합니다.
>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications:
Would you like mbuild to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc C version 2.4.1 in C:\PROGRA~1\MATLAB\R2006b\sys\lcc
[2] Microsoft Visual C/C++ version 8.0 in C:\Program Files\Microsoft Visual Studio 8
[3] Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio
[0] None
Compiler: 2 <-- 원하시는 컴파일러를 선택하시면 됩니다.
Please verify your choices:
Compiler: Microsoft Visual C/C++ 8.0
Location: C:\Program Files\Microsoft Visual Studio 8
Are these correct?([y]/n): y
****************************************************************************
Warning: Applications/components generated using Microsoft Visual Studio
2005 require that the Microsoft Visual Studio 2005 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. More information
is at:
http://www.mathworks.com/support/solutions/data/1-2223MW.html
****************************************************************************
Trying to update options file: C:\Documents and Settings\Yong Lee\Application Data\MathWorks\MATLAB\R2006b\compopts.bat
From template: C:\PROGRA~1\MATLAB\R2006b\bin\win32\mbuildopts\msvc80compp.bat
Done . . .
--> "C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwregsvr C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwcomutil.dll"
DllRegisterServer in C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwcomutil.dll succeeded
--> "C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwregsvr C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwcommgr.dll"
DllRegisterServer in C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwcommgr.dll succeeded
3. 컴파일러를 실행합니다.
mcc -m c:\Gauss.m -o Gauss
실행후 work폴더에 아래의 화일들이 생성됩니다.
Gauss.exe
Gauss.ctf
이제 Gauss.exe를 실행하시면 작성된 m 코드가 실행되는걸 보실 수 있습니다.
아래는 Gaussian Function의 그래프를 보는 간단한 예제 코드입니다.
function Gauss
x=0:0.1:10;
y=gaussmf(x,[2 5]);
plot(x,y)
xlabel('gaussmf, P=[2 5]')
이 코드를 Gauss.m이라는 화일명으로 저장합니다.
2. 컴파일러를 셋팅합니다.
>> mbuild -setup
Please choose your compiler for building standalone MATLAB applications:
Would you like mbuild to locate installed compilers [y]/n? y
Select a compiler:
[1] Lcc C version 2.4.1 in C:\PROGRA~1\MATLAB\R2006b\sys\lcc
[2] Microsoft Visual C/C++ version 8.0 in C:\Program Files\Microsoft Visual Studio 8
[3] Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Studio
[0] None
Compiler: 2 <-- 원하시는 컴파일러를 선택하시면 됩니다.
Please verify your choices:
Compiler: Microsoft Visual C/C++ 8.0
Location: C:\Program Files\Microsoft Visual Studio 8
Are these correct?([y]/n): y
****************************************************************************
Warning: Applications/components generated using Microsoft Visual Studio
2005 require that the Microsoft Visual Studio 2005 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. More information
is at:
http://www.mathworks.com/support/solutions/data/1-2223MW.html
****************************************************************************
Trying to update options file: C:\Documents and Settings\Yong Lee\Application Data\MathWorks\MATLAB\R2006b\compopts.bat
From template: C:\PROGRA~1\MATLAB\R2006b\bin\win32\mbuildopts\msvc80compp.bat
Done . . .
--> "C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwregsvr C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwcomutil.dll"
DllRegisterServer in C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwcomutil.dll succeeded
--> "C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwregsvr C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwcommgr.dll"
DllRegisterServer in C:\PROGRA~1\MATLAB\R2006b\bin\win32\mwcommgr.dll succeeded
3. 컴파일러를 실행합니다.
mcc -m c:\Gauss.m -o Gauss
실행후 work폴더에 아래의 화일들이 생성됩니다.
Gauss.exe
Gauss.ctf
이제 Gauss.exe를 실행하시면 작성된 m 코드가 실행되는걸 보실 수 있습니다.
![사용자 삽입 이미지](https://t1.daumcdn.net/tistoryfile/fs5/13_29_5_5_blog66850_attach_0_0.png?original)