Hold the same values of else

1 Ansicht (letzte 30 Tage)
Inês Correia
Inês Correia am 1 Apr. 2019
Bearbeitet: Adam Danz am 1 Apr. 2019
Vadc <Vdisp is no longer true for the first time and I want the values to hold the same values of else even if Vadc <Vdisp is true again.
function [G,S] = f(H,clock,T,Vadc,Vdisp,R)
if (clock>T+R+0.2)
if (Vadc<Vdisp)
G=H;
S=1;
else
G=pulse;
S=0;
end
else
G=H;
S=1;
end
  3 Kommentare
Inês Correia
Inês Correia am 1 Apr. 2019
Bearbeitet: Inês Correia am 1 Apr. 2019
My problem is that my values are arrays. Pulse is a variable. I forgot that part.
Adam Danz
Adam Danz am 1 Apr. 2019
Bearbeitet: Adam Danz am 1 Apr. 2019
Why is that a problem? Could you provide a complete example that demonstrates the problem?
Also, your variable 'pulse' is never defined in this function. Is it a global variable (if yes, reconsider this choice).

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Mathematics 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!

Translated by