while lopps. help plz ´,
Show older comments
Hi all. I am trying to make a while loops that will keep on running if the user input is a str, a number less and equal 0 or the number is longer the length of my vector. But it doesn't work, plz help:)
deleterowStr=input('Please enter the number of the row:','s');
deleterow=str2num(deleterowStr);
while ~((~isempty( deleterow) && deleterow <=0 || deleterow > length(W)) || strcmpi(deleterowStr,'')==1)
disp('Invaild row number')
deleterowstr=input('Please enter the number of the row:','s');
deleterow=str2num(deleterowstr);
end
thx:)
1 Comment
Joseph Cheng
on 23 Jun 2014
duplicate post http://www.mathworks.com/matlabcentral/answers/137126-problem-in-while-loop-when-input-is-characters-or-words
anyways. I would suggest put a break point in and see why you do not meet the criteria to breakout of the loop.
Accepted Answer
More Answers (0)
Categories
Find more on Parallel Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!