How to reset typing in loop input if is Negative?

Hello,
I want to make a typo refund if there is a user error with negative. For example if a user types negative then the output will return the same as original.
Thanks for the helpers
clc;
clear;
v=input('Insert poisson ratio:'); %Poisson's ratio
if isempty(v) || (v<=0)
end

 採用された回答

Walter Roberson
Walter Roberson 2020 年 12 月 13 日

0 投票

while true
v = input('Insert poisson ratio: '); %Poisson's ratio
if isnumeric(v) && isscalar(v) && v >= 0
break
end
end

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

タグ

質問済み:

2020 年 12 月 13 日

回答済み:

2020 年 12 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by