MATLAB Answers

Is there any possibility of S-function written in C language calling matlab function library, and if so, then how ? I will appreciate that if someone can tell me.

1 ビュー (過去 30 日間)
li
li 2014 年 10 月 15 日
コメント済み: li 2014 年 10 月 22 日
Is there any possibility of S-function written in C language calling matlab function library, and if so, then how ? I will appreciate that if someone can tell me.

  1 件のコメント

Kaustubha Govind
Kaustubha Govind 2014 年 10 月 20 日
Li wrote:
Hi,I know it is possible to call matlab functions from C S functions? But some questions make me suffer a lot.Firstly,the mexCallMATLAB function is used in mexFunction so that inv function from matlab can be called,my question is that how do the C S function and mexFunction compile simultaneously?Secondly, as mentioned above,inv function from matlab is needed,what should i do to convert array from C to mxArray accepted by mex function? Your help will be appreciated!

サインインしてコメントする。

採用された回答

Kaustubha Govind
Kaustubha Govind 2014 年 10 月 21 日
C S-functions are just a special kind of MEX-function, the mexFunction entry-point is defined in simulink.c, which is #included into all S-functions. Please look at the examples in the documentation for mexCallMATLAB for help on converting your C data into mxArrays. Essentially, you need to use one of the mxArray creation functions, and then copy over data from the C variables into the data pointer of the mxArray.

その他の回答 (0 件)

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by