whos Function

The whos function when called without any argument, lists all the variables in the current workspace with their properties. The syntax of the whos function is:

whos <optional parameters>

we shall see the optional parameters in later sections.

Example 1

Let us see the basic working of whos function.

Matlab




%vector 1
x = 1:10;
%vector 2
y = 3:6.7;
 
% listing all variables with their properties.
whos


Here, we have created two vectors, x, and y. Then, we call the whos function to see how it works.

Output:

 

As we can see, we got the name of the two variables, x, and y, and their size, space was taken in Bytes and data type. If there are some more attributes associated with any variables, they will be displayed in the last section. 

List Variables in Workspace With Sizes and Types in MATLAB

MATLAB works with workspaces, which contain all variables, and their metadata. This makes accessing data in large codes easy. However, sometimes there are requirements for listing all the variables in the MATLAB terminal or properties of some particular variables.  Fortunately, MATLAB provides a method to get this job done; using the whos function.

Similar Reads

whos Function

The whos function when called without any argument, lists all the variables in the current workspace with their properties. The syntax of the whos function is:...

Using the Optional Parameters

...