The addition of displaying commands in codes could be very vital for the user of this code in Matlab®. Matlab® provides various kinds of displaying options to users and coders. One of them is the disp() command. It is a very basic and useful displaying command in Matlab®. In this article, we will show you how to use the ‘disp()’ command to display various kinds of variables or characters in Matlab®.
>> a = 775; disp(a); disp('meters'); 775 meters >>
So it is very basic to use the disp() command as above. If you want to display a variable, matrix, or vector in the Command Window, you just type the variable inside the parenthesis of the disp() command in Matlab® as shown above.
If you want to display characters, you need to type the characters inside quotation marks in the parenthesis of the disp() command in Matlab® as shown above.
So it is very basic to use the disp() command in Matlab® to display various variables and strings.
Leave your comments and questions below!
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®