MATLAB Answers

how to use global variables in S-Function Builder which will be compiled and downloaded to a dSPACE DS1103?

4 views (last 30 days)
Jie Huang
Jie Huang on 15 Jan 2014
Edited: Jie Huang on 16 Jan 2014
I'm building a discrete Simulin model with three s-function builders, in which the value of some variables need to be reserved and used in the next discrete update. I can't treat them as the discrete states because 1) the number of the variables can be as many as 50; 2) their value should not be initialized to be constant. So as in C programming, I declare the variables as "extern" in the [libraries]/[include files and external function declarations] pane. And it works if I just run the model in Simulink. But when compiled and downloaded to the DS1103 dSPACE, it didn't work and the result was illogic. Did I miss something? Any answers will be appreciated.

  0 Comments

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!