MATLAB Answers


how run .c program in matlab

manoj saini さんによって質問されました 2013 年 1 月 29 日
最新アクティビティ Walter Roberson
さんによって コメントされました 2019 年 4 月 26 日
if i have program print.c
how i can run this code in MATLAB

  0 件のコメント

サインイン to comment.

2 件の回答

回答者: Shashank Prasanna 2013 年 1 月 29 日

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:

  3 件のコメント

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
2019 年 4 月 26 日
How about now? I guess I can call C directly without the compiling. I am curious about it.
Walter Roberson
2019 年 4 月 26 日
It is not possible to call C or C++ directly from MATLAB without compiling the C or C++.

サインイン to comment.

回答者: syracus syr 2018 年 2 月 1 日

@Shashank Prasanna I don't understand your explanation, how can I create this bat file. What should I put (code) in the file? For example, I have a "execute.bat" file. What should this file contain? Thank you so much!

  3 件のコメント

Walter Roberson
2018 年 2 月 1 日
? I do not see any obvious reference to bat files in the links Shashank Prasanna posted?
syracus syr 2018 年 2 月 2 日
Hi, @Walter Roberson, I want to call C function from within MATLAB with MEX file. I wrote here because I did not know the difference between MEX and BAT files. I've seen this title while researching c language with Matlab. Thank you!
Walter Roberson
2018 年 2 月 2 日
mex files are DLL files with a different file extension, and which define a special function named mexFunction.
If you have an existing DLL then you can use loadlibrary() instead of building a mex interface to the C code.

サインイン to comment.

Translated by