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 ExchangeDynamic 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