Interface between Java and Matlab potential bottleneck?

1 次查看(过去 30 天)
I am optimizing a Simulink Model using several algorithms and I would like to test them in terms of speed. The Matlab scripts used for this are driven by java.
The Problem is: I can see the plots of the optimization being done, the algorithms seem to be completed (f.e. because of maximum iterations) but the java console goes on for a very long time, printing the matlab console output. I suspect that the character stream has to be processed and this does not happen faster via the Matlab Java interface. Is there any way to fix this? I don't need the console output, which is why I also already use the following code to perform the function evaluation.
eng.feval(0, "SIMOptimization", NULL_WRITER, NULL_WRITER);
  2 个评论
Walter Roberson
Walter Roberson 2021-9-14
I wonder if it would help to use an evalc() level, something like
eng.feval(0, "evalc(SIMOptimization);", NULL_WRITER, NULL_WRITER);
Robin
Robin 2021-9-14
编辑:Robin 2021-9-14
Good idea, but SIMOptimization is a script and sadly thats why evalc() seems not to work here, or am i missing something?
EDIT: After searching the forum i came to the idea to create a separate script calling "evalc('SIMOptimization');" and java calls this script. And what can I say, it seems to work wonderfully! Thank you very much for this thought thrust.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by