Matlab Simulink RepMat Execution Time

3 次查看(过去 30 天)
Dear All,
I need a significant help.
I have a Simulink model that has a subsystem that takes a matris [3x1] and makes it [3x11] by just adding them side by side. Normally we were doing that with vector concatenate and it takes nearly 1 ms. With time optimization processes, we decreased that to 0.95 ms but that is too much for us. We need to decrease that value at least half of 1 ms.
My function is basically a repmat. And it takes nearly 0.95 ms on the hardware.
Since operation is not complex at all, we believe that there should be a less time-consuming way.
Any help will be appreciated.
Thanks.
  1 个评论
Ameer Hamza
Ameer Hamza 2020-12-1
Have you inspected the generated code? That might give some hints on why it is taking too long.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2020-12-1
persistent idx11
if isempty(idx11)
idx11 = ones(1,11);
end
y = u(:, idx11) ;

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by