How to use a Matlab script in a Simulink Matlab Function Block, that is calling Matlab Functions.
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I hope, that i somehow can make clear what my problem is:
I do have a Simulink Model. Within this model I wan't to create a Matlab Function Block. The Matlab script, that I want to insert into the Matlab Function Block is already existing. This existing script is calling 9 different Matlab functions, that I need for computing my problem.
How do i make this work? I have to make keep the Matlab "script" and the called "functions" separate, otherwise my script would get way to big.
0 commentaires
Réponses (1)
Fangjun Jiang
le 23 Mar 2020
Modifié(e) : Fangjun Jiang
le 23 Mar 2020
You can certainly do that. Just figure out the input/output of your script and make it the top-level function of your MATLAB Function block. In this simple example, you can call abs() which is a MATLAB function. You can also call MyOtherFun() which is your own function, saved in MyOtherFun.m file.
function y = fcn(u)
y =MyOtherFun(u);
y= abs(y);
0 commentaires
Voir également
Catégories
En savoir plus sur Simulink Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!