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

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

how run .c program in matlab

Asked by manoj saini on 29 Jan 2013

if i have program print.c #include<stdio.h> #include<conio.h> main() {

printf('hello')
getchar()
}

how i can run this code in MATLAB

0 Comments

manoj saini

Products

No products are associated with this question.

1 Answer

Answer by Shashank Prasanna on 29 Jan 2013
Accepted answer

If you want to call your C function from within MATLAB you have to create a MEX file. Which mean you will have to modify your C code with the following guidelines:

http://www.mathworks.com/help/matlab/matlab_external/using-mex-files-to-call-c-c-and-fortran-programs.html

http://www.mathworks.com/help/matlab/matlab_external/c-c-source-mex-files.html

1 Comment

Titus Edelhofer on 29 Jan 2013

Or compile your C code in your favourite C programming environment into a dll/shared object and use loadlibrary to run it inside MATLAB.

Shashank Prasanna

Contact us