hello i make an IF statement:
d=input('Is this spur gear mounted between two bearing? (Y/N): ','s');
if d=='N'
error('this program is not for you');
elseif d~='Y' | d~='N'
disp('you must use capital letters')
return
end
i would, if the second condition is true, to restart the code from
d=input('...
how can i do this?

 채택된 답변

Rick Rosson
Rick Rosson 2016년 3월 12일
편집: Rick Rosson 2016년 3월 12일

0 개 추천

k = [];
while isempty(k)
d=input('Is this spur gear mounted between two bearing? (Y/N): ','s');
k = findstr(upper(d),'YN');
if isempty(k)
fprintf('Invalid response. Please try again.\n');
end
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2016년 3월 12일

편집:

2016년 3월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by