Calling a Matlab function from workspace to Simulink matlab function block
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lidia Itzel Morales Gaitán
am 14 Jan. 2019
Kommentiert: Lidia Itzel Morales Gaitán
am 15 Jan. 2019
I have 2 functions that I want to use in the Matlab_function block in simulink, however, the functions are too long for copying and writing them in the script of the block (I get this display " Output truncated. Text exceeds maximum line length for Command Window display."). I tried only calling them or using function handle in the block script but it doesn't work. Is there a way I can call this function into my simulink file?
0 Kommentare
Akzeptierte Antwort
Sayyed Ahmad Fani Yazdi
am 14 Jan. 2019
use in simulink function
eml.extrinsic('YourFunctionNameInMatlab');
for example
function [val_out] = fcn(Val_in)
%#eml
eml.extrinsic('YourFunctionNameInMatlab');
Val_out=zeros(1);
[Val] = YourFunctionNameInMatlab(Val_in);
you code use the same rule for a function with more than one input value and more than one output value
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!