Text strings are entered into MATLAB surrounded by single quotes. For
s = 'This is a test'assign the given text string to the variable s.
Text strings can be displayed with the function disp. For example:
disp('this message is hereby displayed') or fprintf('this message is hereby displayed\n')
Error messages are best displayed with the function error
error('Sorry, the matrix must be symmetric')since when placed in an M-file, it causes execution to exit the M-file.
In an M-file, the user can be prompted to interactively enter input data with the function input. When, for example, the statement
iter = input('Enter the number of iterations: ')is encountered, the prompt message is displayed and execution pauses while the user keys in the input data. Upon pressing the return key, the data is assigned to the variable iter and execution resumes.