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

New to MATLAB?

how run .c program in matlab

Asked by manoj saini

manoj saini (view profile)

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

manoj saini (view profile)

Products

No products are associated with this question.

1 Answer

Answer by Shashank Prasanna

Shashank Prasanna (view profile)

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

Titus Edelhofer (view profile)

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

Shashank Prasanna (view profile)

Contact us