Global variables in Matlab C-Coder
Ältere Kommentare anzeigen
Hi there,
I am using Matlab-C-Coder App to translate a Matlab function to C. In the calling script as well as in the called function I declare the same global variables. These variables are also defined by initial value under 'Define Input Types: Add globals' in the Coder App. I display the values of global variables at the end of the calling script.
I do 'check for issues'; then in the 'test output' area it shows the global variables are all empty! On the other hand, if I initialize them at the beginning of the calling script, output shows still the initial values, but no changes which the called functions may have done to them.
It seems that the exchange of global variables between calling script and called function is somehow a problem for C-coder.
I appreciate your help on this! Best regards, Heinz
2 Kommentare
Xiaoying ZHI
am 15 Nov. 2018
Hi there. Have you solved this problem? I seem like have encountered a similar problem.
Ryan Livingston
am 16 Nov. 2018
What release of MATLAB are you using?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu MATLAB Coder finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!