Hold the same values of else

조회 수: 2 (최근 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에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by