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 comentario

Bilal Bukhary
Bilal Bukhary el 17 de Abr. de 2020
how to make this code repeat from the begining if, Res(1,i)<0 | imag(Res(1,i))~=0 statement is true

Iniciar sesión para comentar.

 Respuesta aceptada

KSSV
KSSV el 17 de Abr. de 2020

0 votos

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

Más respuestas (0)

Categorías

Más información sobre Dynamic System Models en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 17 de Abr. de 2020

Respondida:

el 17 de Abr. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by