Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
compiling a Matlab file into 'c'

Subject: compiling a Matlab file into 'c'

From: Emma Robertson

Date: 24 Oct, 2011 17:34:24

Message: 1 of 3

Hi all,

I have a code which is running really slow in Matlab (due to a long loop), so I thought I should run it in 'c' instead. However, when I enter
            mcc -B sharedlib:libmyfilename filename.m
I get the following warning:
*****************
You are using gcc version "4.1.2". The version currently supported with Matlab compiler is "4.3.4". For a list of currently supported compilers see: http://......
*****************

At the moment, I'm using the uni's Linux machine with Matlab 2011b. How can I upgrade gcc version and do I need administrative privilege?

Also my main running file refers to several other scripts within the directory. Would this be a problem in compiling? (as I read in help: "functionality that cannot be recalled directly from the command line will not compile"). I think this issue can be resolved by putting all the scripts in one file instead of referring to them (?).

Many thanks,
Emma

Subject: compiling a Matlab file into 'c'

From: Emma Robertson

Date: 25 Oct, 2011 21:22:29

Message: 2 of 3

I solved the above issue. But, can someone please give me a hint on how to run a Matlab code in 'c' (Xcode)?

1st. step: Type in Matlab command line "mcc -B csharedlib:libmyfilename filename.m"
2nd step: ????
3rd step: ????

Thanks in advance.
PS: 'c' is totally alien to me -- so please bear with me.

Subject: compiling a Matlab file into 'c'

From: Steven_Lord

Date: 26 Oct, 2011 13:33:51

Message: 3 of 3



"Emma Robertson" <ma87@hotmail.co.uk> wrote in message
news:j879al$8cr$1@newscl01ah.mathworks.com...
> I solved the above issue. But, can someone please give me a hint on how to
> run a Matlab code in 'c' (Xcode)?

If you need to generate C code from your MATLAB function, use MATLAB Coder.

http://www.mathworks.com/products/matlab-coder/?s_cid=global_nav

If you need to run your application on a machine that could run MATLAB but
on which MATLAB is not installed, you can use MATLAB Compiler.

http://www.mathworks.com/products/compiler/?s_cid=global_nav

The documentation for each of those products includes instructions on how to
use the products to create the C code or the deployable application.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us