Re: Help with Matlab loops



In article <13690128.1193865263587.JavaMail.jakarta@xxxxxxxxxxxxxxxxxxxxxx>,
gabo949 <gabomj13@xxxxxx> wrote:
Hi, I'll appreciate if someone gives me the commands on how to do the
following: ask the user to input a value for threshold of the impulse
response. This values must be in the range from 0.07 to
0.10;error-check to make sure that the threshold is in that range.

As your question is written in a form that sounds like part of
a class assignment, I will not give an exact answer. You will need
to adapt the below to handle decimals.

R = [];
while isempty(R)
R = INPUT('How many apples?', 's');
if isempty(R)
disp('That was no answer!');
continue;
end
if any(~ismember(lower(R),'0123456789'))
disp('That was not a number!');
R = [];
continue;
end
RN = sscanf(R,'%d');
if isempty(RN) || RN < 7 || RN > 10
disp('Too few or two many, try again!');
R = [];
continue;
end
end
disp(num2str(RN,'How do you like dem %d apples?'));
--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
.