Why does my model fail using ELSEIF in an Embedded MATLAB Function Block in Simulink 6.1(R14SP1)?
Afficher commentaires plus anciens
My model does not work if I use ELSEIF in an Embedded MATLAB Function Block in Simulink 6.1(R14SP1). The code in my Embedded MATLAB Function Block is below:
function y = fcn(u)
% This block supports an embeddable subset of the MATLAB language.
% See the help menu for details.
if (u<0)
x = 1;
elseif (u>=0)
x = 2;
end
y = x/2;
When I try to run my model, I get the following error:
Variable x must be unambiguously written to before use.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Simulink dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!