disp function error in matlab coder

7 次查看(过去 30 天)
aarthy reddy R
aarthy reddy R 2019-10-14
评论: Adam 2019-10-14
disp(["Generation #", int(g)]);
the above line is showing error in my code
shows following error
Error in GeneticAlgorithm (line 11)
disp(["Generation #", int(g)]);
any suggestions for this error

回答(1 个)

Adam
Adam 2019-10-14
disp is not supported by Coder. sprintf should work though.
  2 个评论
aarthy reddy R
aarthy reddy R 2019-10-14
can u kindly help me out for using disp function
because i am getting errors by using sprintf function
Adam
Adam 2019-10-14
I don't know what
int(g)
is supposed to represent. There isn't an int() function in base Matlab. I also don't know what you are doing with sprintf to give you errors since you didn't post it.
In general sprintf can very simply directly replace disp, but I don't know what your disp function is trying to output since I don't know what int( ) is.
sprintf( "Generation #%i", g )
should theoretically work fine though.

请先登录,再进行评论。

类别

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