Round function with multiple inputs not working in MATLAB function block in Simulink
Ältere Kommentare anzeigen
Hi all,
I want to round a number to 3 decimal places. In MATLAB I can easily do it in this way:
>> number=25.0001;
>> round(25.0001,3)
ans =
25
If I try to do this in Simulink in a MATLAB Function block in this way:
function D_avg1 = fcn(m)
%#codegen
D_avg1 = round(m,3);
It gives error:
Error calling 'round'. This call-site passes more inputs to this function than it can accept.
Function 'BSD_System /Averaging/MATLAB Function' (#278.45.55), line 4, column 10:
"round(m,3)"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
How to solve this?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Simulink Functions finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!