lettura simple

List of Variables in Matlab

When you define a variable in Matlab, it's like you're putting a little piece of information in a box. And as you keep defining more variables, more boxes keep getting added to the workspace.

Now, the beauty of Matlab is that you can always keep track of all the variables you've defined so far.

You can simply type in the command "who" and it'll give you a list of all the variables that are currently stored in the workspace.

who

Let me give you a practical example.

Define four variables.

>> a=1
a = 1
>> b=2
b = 2
>> c=3
c = 3
>> d=4
d=4

To see the list of variables in the workspace, type the command "who".

>> who

The "who" command reads and displays all the names of the variables present in the workspace. Your variables are:

Your variables are:

a b c d

But if you want to dig deeper and get more information about each variable, you can use the command "whos".

This command will not only give you the name of the variable but also its data type, size, and number of bytes it takes up in memory.

list of variables

And the best part? You don't even have to remember these commands by heart.

You can always find them in the Matlab interface, in the Workspace section, which is conveniently located on the left side of your screen.

List of variables in the workspace.

So, you see, with Matlab, you can keep track of all your variables and their properties with ease.

It's just like keeping your tools organized in a toolbox.




Report a mistake or post a question




FacebookTwitterLinkedinLinkedin