MATLAB: How to have input function continue if enter key pressed

MATLAB

I would like to have an input statement such as
response = input('Press enter to continue:','s')
and a while loop
while respond == '' end
This is not working exactly as planned. What is the best way to evaluate the return/enter key being pressed

Best Answer

Do not compare a string to '' -- a string is an array of characters, so the comparison would fail if there are any characters in the string (because the length of the character array would not be the same as the length of '' )
You can use isequal() or strcmp(), but what you should really use here is isempty()
Related Question