update output in MATLAB function block each second time
Mostra commenti meno recenti
Hi, I have one MATLAB function block working on my Simulink/simevents project, but i would like to update the level var "var" when the condition is right every second of my time simulation. I mean, my "error" var change every second of my period, but i cant get that this value do that the call function fcn.... I dont know if im very clear...sorry....!
Parameters: lev - output, that i want update thr_up_out,error,step - inputs (thr_up_out and step are fixed values. Constants) (error is varaiable each second) This is my function function lev = fcn(thr_up_out,error,step) persistent var; if isempty(var) var=0; lev=0; else var=2; lev=0; if ((error>0)&&(error>thr_up_out)) %Actualizamos el Nivel, seteandolo inicialmente a 2, x el step de %crecimiento lev=var+2; end end
Someone can I help me ,please!!?? Thaaaaanks!! :-)
Risposte (0)
Categorie
Scopri di più su Discrete-Event Simulation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!