# Graphical User Interface

## Executing commands

In MATLAB you can execute commands either by directly entering them into the command window or by executing them from the script editor.

The most common way to execute commands is while working on a script/program (called *.m file*). After opening a (new) script in MATLAB, enter the commands into the script editor, then execute single commands by right-clicking on them and choosing "Evaluate" or run your whole script by clicking "Run". A good tip is to always start your script with the following three commands that will clear your workspace, close any open plots and clear the console.

```
clear all; close all; clc;
```

![Executing a command from the script editor](/files/-LpPraM6rG7qTu14KpvZ)

Alternatively, you can execute commands by directly typing them into the command window and hitting the return key (Enter) on your keyboard to evaluate them. This is very useful e.g. for trying out commands, opening help/documentation on a command or performing one-time actions such as manually exporting data.

![Executing a command from the Command Window](/files/-LpPreAuK8GcBhSbFKHG)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://coding-courses.gitbook.io/matlab/crashcourse/graphical-user-interface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
