1. input
x = input(prompt)
Prompt is a text string, used to prompt input.
eg.
prompt = 'What is the original value? ';
x = input(prompt)
y = x*10
Two, disp output
1、disp(X)
Display the value of x without printing the variable name. i.e. no 'x' appears /
2、ans = disp(x)
Another way to display a variable is to type its name, this method will display a prefix before the value, like 'ans='
Three, fprintf
fprintf(formatSpec,A1,...,An)% Format the data and display the result on the screen.
formatSpec: string, but contains the output format of the data. In the final result output in the command line window, the value of A appears in the output format
Output format:
1. %4.2f floating point number, the field width is four digits, including two digits after the decimal point
2. %d integer
Note: \n newline