Info
This question is closed. Reopen it to edit or answer.
which function performs better in code generation
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!