How do I link extern variables and stateflow input when using custom c code?

2 ビュー (過去 30 日間)
Alexander Dingwall
Alexander Dingwall 2019 年 5 月 13 日
コメント済み: Alexander Dingwall 2019 年 5 月 13 日
I am trying to use a custom C code function in my stateflow chart. The C file looks like
extern float A1;
extern float A2;
extern float A3;
float do_something(void) {
return cos(A1)*sin(A2)*cos(A3);
}
I also have three stateflow inputs of the same name? When I run the simulink model, I get undefined reference errors for A1, A2 and A3. How can link the inputs with the extern variables so that the inputs to the stateflow chart can be used in the C code function?
Also please don't tell me to do:
float do_something(float A1, float A2, float A3) {
return cos(A1)*sin(A2)*cos(A3);
}
Since, I know that this works. I need the inputs to be assigned to the extern variables.
Thanks

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2019 年 5 月 13 日
  1 件のコメント
Alexander Dingwall
Alexander Dingwall 2019 年 5 月 13 日
This example isn't the same as what I want.
I can't upload my model and C code if you want?

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

カテゴリ

Help Center および File ExchangeComplex Logic についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by