Info

此问题已关闭。 请重新打开它进行编辑或回答。

which function performs better in code generation

1 次查看(过去 30 天)
Hello,
I'm working at a Simulink model where I use many Matlab function blocks, I want to implant the model in a microchip by code generation of Simulink later. So I'm wondering which type of function performes better in code generation, a code of type C or an integrated matlab function?
For exemple, if I want to find the maximum value of an array in my Matlab fonction block, I have two choices :
a general way like :
a = [1 5 3 6 3 8];
Max_value = a(1);
for i = 2:length(a)
if a(i) > Max_value
Max_value = a(i);
end
end
or I can use an integrated matlab fonction :
a = [1 5 3 6 3 8];
Max_value = max(a);
The two types of code give me the same result, but I'm wondering which performes better in code generation about execution time, memories, etc.
Thanks in advance for your answers.

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by