MATLAB Answers

how run .c program in matlab

446 ビュー (過去 30 日間)
manoj saini
manoj saini 2013 年 1 月 29 日
コメント済み: LeChat 2020 年 5 月 14 日 19:49
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 件のコメント

サインイン to comment.

採用された回答

Shashank Prasanna
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:

  7 件のコメント

表示 4 件の古いコメント
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 日 19:49
thank you Walter

サインイン to comment.

その他の回答 (1 件)

syracus syr
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
Walter Roberson 2018 年 2 月 1 日
? I do not see any obvious reference to bat files in the links Shashank Prasanna posted?
syracus syr
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
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