Info
この質問は閉じられています。 編集または回答するには再度開いてください。
matlab to c
1 回表示 (過去 30 日間)
古いコメントを表示
I converted a function using matlab using matlab coder. in .m file i had declared:----
>> a.b = 37000; a.c = 8;
but as output in .c file i got:----
>>a.b=34000.0 a.c =7.0
? why has the values changed?
1 件のコメント
Kaustubha Govind
2011 年 7 月 28 日
Could you include a simple code snippet that we can use to reproduce the issue. It might also help to mention the command you used to generate code, as well as the MATLAB version.
回答 (2 件)
Walter Roberson
2011 年 7 月 28 日
Do those variables happen to be loop control variables in a context where they are incremented by 3000 and 1 respectively before they are used?
2 件のコメント
Arnaud Miege
2011 年 7 月 29 日
As previously asked, can you post a code snippet and the command used to generate the code, so that we can reproduce the issue?
Mike Hosea
2011 年 8 月 1 日
I echo the requests for more of the code. However, let me just point out that MATLAB Coder performs some optimizations. If you had code like this
n = 1;
if ~isreal(x)
n = n + 1;
end
You will probably see
n = 2.0;
generated if x is not real. Is it possible that after your assignment there are statements that the compiler can evaluate during compilation because the values/conditions are already known? -- Mike
0 件のコメント
この質問は閉じられています。
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!