I am writing a function that prompts the user for a number immediately followed by a letter of the alphabet. The format should be number first then letter after. I got error when I called the function up , I typed 123d and it said Unexpected MATLAB operator.
Here is the example:
Enter a letter and a #: xyz4.5tError!Enter a letter and a #: 3.21fnum =3.2100let =f
And here is my code
function[num let] = readthem(word) fprintf('Please enter a number immediately followed by a letter of the alphabet \n') word = input('Enter a letter and a #: ') while isnumeric(num)==0 || isletter('let')== 0 word = input('Enter a letter and a #: ') end sprintf('You enter %d%s',num,let)end
Best Answer