Solution to Exercise 1

MATLAB Script Solution
abc = input('Please enter x: ', 's');
if abc ~= 'x',
fprintf('Error: you entered something else\n');
end
Code Explanation:
Alternative Implementation (with else clause):
% Alternative approach with else clause
user_input = input('Please enter x: ', 's');
if strcmp(user_input, 'x')
% Do nothing - user followed instructions
else
fprintf('Error: You did not follow instructions!\n');
end

Note: This version uses strcmp() for string comparison, which is more robust for different data types.

Code Explanation: