Global variables in Matlab C-Coder

조회 수: 3 (최근 30일)
Heinz Roitner
Heinz Roitner 2017년 11월 29일
답변: Heinz Roitner 2018년 11월 29일
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
Xiaoying ZHI
Xiaoying ZHI 2018년 11월 15일
Hi there. Have you solved this problem? I seem like have encountered a similar problem.
Ryan Livingston
Ryan Livingston 2018년 11월 16일
What release of MATLAB are you using?

댓글을 달려면 로그인하십시오.

채택된 답변

Heinz Roitner
Heinz Roitner 2018년 11월 29일
My problem was caused by the fact that the code was written with R2017b, but was tested on a machine with R2017a. After R2017b was installed there, problem was gone.
--Heinz

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by