Matlab coder error, help please

조회 수: 5 (최근 30일)
papoo
papoo 2016년 10월 12일
댓글: papoo 2016년 10월 13일
The initial value specified for global variable XXX is not contained by the global variable's type
I have defined the variable right after. Any idea?
Thanks.
  댓글 수: 2
Preethi
Preethi 2016년 10월 12일
hello,
can you please elaborate?
papoo
papoo 2016년 10월 13일
Sure, I am addressing this in the other answer. Please read that.

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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 10월 12일
You tried to initialize a global variable to a value that cannot be represented by the datatype of that variable. For example you might have defined the variable as int8 but tried to initialize it to 255 (which would fit in uint8 but not in int8)
  댓글 수: 1
papoo
papoo 2016년 10월 13일
Thanks Walter and Preethi for quick responses. Feels like a true community! :)
As I said earlier, I had the variable X defined as global and fill it with a X = zeros(7,7) so matlab coder get it how I want to use it later in C. However, it kept on giving me that error. I managed to get rid of the error by doing the first allocation as X = 0; !!! and that has not giving me any error even though I am still using the variable X down the code as a 7x7 matrix. Giving this that I have not been able to run the C code yet as I working on other parts of it.
Even though I have managed to fix the error, I am still curious to know what is the cause for it or if Walter still has the same opinion.
Thanks,

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

카테고리

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