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

2 views (last 30 days)
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

Answers (1)

Fangjun Jiang
Fangjun Jiang on 13 May 2019

Categories

Find more on Complex Logic in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!