running c program in matlab
9 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a general doubt. I have a c program and I would like to execute the program inside the matlab using unix command.For example if the .c file is "scale.c". Then if I give unix(scale);
it always show an error "..is not recognized as an internal or external command, operable program or batch file". Kindly provide a solution for this.
2 件のコメント
Walter Roberson
2013 年 12 月 26 日
Do you want to start it as an independent program? or do you want to start it as an independent program except passing in stdin and out stdout? Or do you want to call various routines in the C source as if they are commands written in MATLAB, with access to the variables ?
回答 (4 件)
Image Analyst
2013 年 12 月 26 日
Can you compile it into a standalone executable and run it with the system() function?
0 件のコメント
Walter Roberson
2013 年 12 月 27 日
To call routines in the C source, you have two choices:
- You can compile the C source as a library, and then loadlib() the library and call the routines; or
- You can create a MEX interface to the C source, compile it all with "mex", and then it can be called as if it is built-in MATLAB functionality.
0 件のコメント
The Matlab Spot
2013 年 12 月 26 日
1 件のコメント
The Matlab Spot
2013 年 12 月 26 日
編集済み: The Matlab Spot
2013 年 12 月 26 日
are you trying to use the .c file in Simulink or a MATLAB program (script/function)?
The Matlab Spot
2013 年 12 月 26 日
I dont know about using unix commands, But Can you check out if you can use C-Shared Libraries instead
参考
カテゴリ
Help Center および File Exchange で MATLAB Compiler についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!