MATLAB Function Versus MATLAB S-Function (processing speed)

My problem is a simple example in the picture.
Top S-function written in C++. Lower Matlab function written in Matlab. Blocks of the same function, but the top is 4 times faster! Why? Maybe this is due to the creation of the wrapper in the case of the lower block? M-code consists of five lines, and 800 lines of the wrapper. wrapper slows down speed of model?

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2013년 2월 25일

0 개 추천

It could be that you have Enable debugging/animation enabled in the 'Simulation Target' pane of the Configuration Parameters window. If you disable this (and perhaps even overflow detection and memory integrity checking), it should cut down the size of the generated code, and improve the speed of the MATLAB Function block.

댓글 수: 1

In my model Enable debugging/animation disable.
The question is why the S-function block is faster than block Matlab function.
The problem of automatic generation of sub-optimal complex wrapper?
Matlab interpreter, and each line of Matlab code, it converts the C code using the wrapper, which reduces the speed of the model?

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

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

질문:

2013년 2월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by