Hold the same values of else

4 次查看(过去 30 天)
Inês Correia
Inês Correia 2019-4-1
编辑: Adam Danz 2019-4-1
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 个评论
Inês Correia
Inês Correia 2019-4-1
编辑:Inês Correia 2019-4-1
My problem is that my values are arrays. Pulse is a variable. I forgot that part.
Adam Danz
Adam Danz 2019-4-1
编辑:Adam Danz 2019-4-1
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).

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by