How to make MATLAB stand-alone application?

I have a small Matlab m file which uses matlab signal processing toolbox, it basically is filtering noise from my signals. I want to run it outside MatLab environment. How can I make it an exe file so that I can run it in dos?
here is my m file
[b,a] = butter(9,.02,'low'); x=textread('noisy.out'); y=filter(b,a,x); save filtered.out y -ASCII
my compiler is
Lcc C version 2.4 in
when I run the following command
mcc -m myfilter.m -o mehdi
to make exe file I get the following error
Error: File "myfilter" is a script M-file and cannot be compiled with the current Compiler.
please help me how I can resolve this problem?

답변 (1개)

Walter Roberson
Walter Roberson 2011년 3월 7일

0 개 추천

At the top of your file, you need to add
function myfilter
to convert it from a script in to a function.
Note: I seem to recall that filter design was one of the things you are not allowed to compile, so I don't know if you will be able to compile calls to butter() .

댓글 수: 4

maadi
maadi 2011년 3월 7일
I put function myfilter but did not work
do I need to use another compiler to make it work?
Walter Roberson
Walter Roberson 2011년 3월 8일
What happened when you added that line? What message(s) did you get?
You seem to be using Windows; which Matlab version are you using, and are you using the 32 bit or 64 bit version?
maadi
maadi 2011년 3월 11일
Yes I am using 32 bit windows.
I am trying to build a compiler as you see below
>> 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 in D:\MATLAB7\sys\lcc
[0] None
Compiler: 1
Please verify your choices:
Compiler: Lcc C 2.4
Location: D:\MATLAB7\sys\lcc
Are these correct?([y]/n): y
Try to update options file: C:\Documents and Settings\Erik\Application Data\MathWorks\MATLAB\R14\compopts.bat
From template: D:\MATLAB7\BIN\WIN32\mbuildopts\lcccompp.bat
Done . . .
--> "D:\MATLAB7\bin\win32\mwregsvr D:\MATLAB7\bin\win32\mwcomutil.dll"
DllRegisterServer in D:\MATLAB7\bin\win32\mwcomutil.dll succeeded
--> "D:\MATLAB7\bin\win32\mwregsvr D:\MATLAB7\bin\win32\mwcommgr.dll"
DllRegisterServer in D:\MATLAB7\bin\win32\mwcommgr.dll succeeded
after setting up the dll files I use this command to make my exe file
mcc -m myfilter.m -o myfilter
But I fail and this is the error message I got
??? Error: File "myfilter" is a script M-file and cannot be compiled with the current Compiler.
Thanks
Kaustubha Govind
Kaustubha Govind 2011년 3월 11일
As Walter suggested, you need:
function myfilter
[b,a] = butter(9,.02,'low'); x=textread('noisy.out'); y=filter(b,a,x); save filtered.out y -ASCII
It doesn't seem like you've added function myfilter to the top of your script to convert it to a function.
@Walter: MATLAB Compiler should support the BUTTER function (see http://www.mathworks.com/products/compiler/compiler_support.html)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 Application Deployment에 대해 자세히 알아보기

질문:

2011년 3월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by