if i have program print.c
#include<stdio.h>
#include<conio.h>
main()
{
printf('hello')
getchar()
}
how i can run this code in MATLAB

 Respuesta aceptada

Shashank Prasanna
Shashank Prasanna el 29 de En. de 2013

2 votos

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:

8 comentarios

Titus Edelhofer
Titus Edelhofer el 29 de En. de 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.
rui gao
rui gao el 26 de Abr. de 2019
How about now? I guess I can call C directly without the compiling. I am curious about it.
Walter Roberson
Walter Roberson el 26 de Abr. de 2019
It is not possible to call C or C++ directly from MATLAB without compiling the C or C++.
Noam Greenboim
Noam Greenboim el 2 de Feb. de 2020
The links are not working anymore
LeChat
LeChat el 17 de Abr. de 2020
indeed the links do not work anymore...
Walter Roberson
Walter Roberson el 17 de Abr. de 2020
The second one is currently at
I am not sure what the equivalent of the first one is. Possibly
LeChat
LeChat el 14 de Mayo de 2020
thank you Walter
Francis Tiong
Francis Tiong el 3 de Nov. de 2021

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Centro de ayuda y File Exchange.

Preguntada:

el 29 de En. de 2013

Comentada:

el 3 de Nov. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by