| MATLAB Function Reference | Search  Help Desk |
| disp | Examples See Also |
disp(X)
disp(X)
displays an array, without printing the array name. If X contains a text string, the string is displayed.
Another way to display an array on the screen is to type its name, but this prints a leading "X =," which is not always desirable.
One use of disp in an M-file is to display a matrix with column labels:
disp(' Corn Oats Hay')
disp(rand(5,3))
which results in
Corn Oats Hay
0.2113 0.8474 0.2749
0.0820 0.4524 0.8807
0.7599 0.8075 0.6538
0.0087 0.4832 0.4899
0.8096 0.6135 0.7741
format Control the output display format
int2str Integer to string conversion
num2str Number to string conversion
rats Rational fraction approximation
sprintf Write formatted data to a string