How to reset typing in loop input if is Negative?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Walter Roberson
2020-12-13
while true
v = input('Insert poisson ratio: '); %Poisson's ratio
if isnumeric(v) && isscalar(v) && v >= 0
break
end
end
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!