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

 채택된 답변

Shashank Prasanna
Shashank Prasanna 2013년 1월 29일

2 개 추천

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

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

질문:

2013년 1월 29일

댓글:

2021년 11월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by