Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to make matlab m-file executable?

Status
Not open for further replies.

karim.elmahdy

Junior Member level 2
Joined
Dec 2, 2005
Messages
22
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,283
Activity points
1,595
Yes of course,

you can use the MATLAB Compiler to make Stand-Alone Applications and here is a hint about how it works, I hope its enough for you.


The MATLAB Compiler, when invoked with the -m macro option, takes the input M-files and produces the required wrapper file suitable for a stand-alone application. Then, your C or C++ compiler compiles this code and links against the MCR, which is a stand-alone set of shared libraries that enable the execution of M-files. For example, to generate a stand-alone executable from the file example.m, use

Code:
[size=18]mcc -m example[/size]
where: mcc is the compliling command in MATLAB
-m is the macro option ( telling the compiler that it is .m file to be compiled)
example is the name of the .m file as you saved it.

Godd luck.

Added after 1 minutes:

Yes of course,

you can use the MATLAB Compiler to make Stand-Alone Applications and here is a hint about how it works, I hope its enough for you.


The MATLAB Compiler, when invoked with the -m macro option, takes the input M-files and produces the required wrapper file suitable for a stand-alone application. Then, your C or C++ compiler compiles this code and links against the MCR, which is a stand-alone set of shared libraries that enable the execution of M-files. For example, to generate a stand-alone executable from the file example.m, use

Code:
[size=18]mcc -m example[/size]
where: mcc is the compliling command in MATLAB
-m is the macro option ( telling the compiler that it is .m file to be compiled)
example is the name of the .m file as you saved it.

Godd luck.
 

neoaspilet11

Full Member level 5
Joined
Sep 29, 2005
Messages
277
Helped
29
Reputation
56
Reaction score
8
Trophy points
1,298
Location
Cebu, Philippines
Activity points
4,048
Very Good, Thank you very much for this wonderful information, Two more questions;

1.) I have not seen what filename should be use for the executable file. Is this automatically generated or I need to tell matlab what should be its filename? and how should I do it?

2.) What folder does the executable file is in?

I'll try this at home this night.
Thanks,
Jack
 

karim.elmahdy

Junior Member level 2
Joined
Dec 2, 2005
Messages
22
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,283
Activity points
1,595
Dear Jack,

as shown in the command you give as a parameter the .m filename and it matlab creates the executable files in the same folder where the .m file is in and by the same name of the original .m filename.

Hope I've had helped enough.

Karim
 

HMZ

Junior Member level 2
Joined
Jan 6, 2004
Messages
23
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,283
Location
Earth,Iran,Tehran unfortunately
Activity points
200
it is easy to ask it from matlab itself by
help mcc
and you'll get:
Make stand-alone C executable for myfun.m. Look for myfun.m in the directory /files/source, and put the resulting C files and executable in directory /files/target:
mcc -m -I /files/source -d /files/target myfun
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top