ki_YesNo='No'
% ...
switch ki_YesNo
case 'NO'
% ...
case 'Yes'
% ...
otherwise
error('ki_YesNO = Yes or No');
end
Notice that's switch 'NO' (with an upper-case O), but ki_YesNo is 'No' (lower-case o). 'No' is not the same as 'NO', and 'No' is not the same as 'Yes', so the code went to the otherwise branch and the error was thrown.
If you want the match to be case-insensitive, so that 'no', 'No', 'NO', and 'nO' all go to the 'NO' branch (and similarly 'yes', 'YES', 'yEs', etc., all go to the 'Yes' branch), one way to do that is:
switch lower(ki_YesNo) % make lower-case
case 'no' % check against lower-case
% ...
case 'yes'
% ...
otherwise
error('ki_YesNO = Yes or No');
end