Res=input ('Enter the resistance values in ohm,R1 to Rn,values must be positive and real > ');
for i=1:1:n
if Res(1,i)<0 | imag(Res(1,i))~=0
Res=input ('Enter the resistance values in ohm,R1 to Rn,values must be positive and real > ');
end
end
how to make this code repeat from the begining from the bigginig if statement is true

댓글 수: 1

Bilal Bukhary
Bilal Bukhary 2020년 4월 17일
how to make this code repeat from the begining if, Res(1,i)<0 | imag(Res(1,i))~=0 statement is true

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2020년 4월 17일

0 개 추천

n = 4 ;
for i=1:1:n
Res(i)=input ('Enter the resistance values in ohm,R1 to Rn,values must be positive and real > ');
while Res(i)<0
Res(i)=input ('Enter the resistance values in ohm,R1 to Rn,values must be positive and real > ');
end
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Dynamic System Models에 대해 자세히 알아보기

태그

질문:

2020년 4월 17일

답변:

2020년 4월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by