Workspace-Variablen und MAT-Dateien
Der Workspace enthält Variablen, die Sie in MATLAB erstellen oder aus Datendateien sowie anderen Programmen importieren können. Sie können den Inhalt des Workspace im Workspace-Fensterbereich oder im Befehlsfenster anzeigen und bearbeiten. Weitere Informationen finden Sie unter Erstellen und Exportieren von Variablen.
Workspace-Variablen werden nach dem Beenden von MATLAB nicht beibehalten. Wenn Sie Ihre Daten über mehrere Sitzungen hinweg verwenden möchten, speichern Sie sie in einer komprimierten Datei mit einer .mat
-Erweiterung, die MAT-Datei genannt wird. Sie können gespeicherte Daten wiederherstellen, indem Sie eine MAT-Datei wieder in MATLAB laden. Weitere Informationen finden Sie unter Save and Load Workspace Variables.
Tools
Workspace Panel | Interactively manage workspace contents |
Variables Editor | Interactively view, edit, and analyze workspace variables |
Import Tool | Import data from file |
Live Editor Tasks
Importieren von Daten | Import data from a file in the Live Editor (Seit R2023a) |
Funktionen
load | Load variables from file into workspace |
save | Save variables from workspace to file |
matfile | Access and change variables in MAT-file without loading file into memory |
disp | Anzeigen des Werts einer Variablen |
formattedDisplayText | Capture display output as string (Seit R2021a) |
who | List variables in workspace |
whos | List variables in workspace, with sizes and types |
clear | Remove items from workspace, freeing up system memory |
clearvars | Clear variables from memory |
Themen
- Erstellen und Exportieren von Variablen
Erstellen, bearbeiten und kopieren Sie Variablen im MATLAB-Workspace mithilfe des Befehlsfensters, des Workspace-Fensterbereiches und des Variablen-Editors.
- Save and Load Workspace Variables
Save some or all variables in the current workspace and reload the variables later during the current MATLAB session, or during another session.
- Modify Workspace and Variables Settings
Set settings for the Workspace panel and Variables editor.
- MAT-File Versions
There are several versions of MAT-files that each support an increasing set of features, starting with MAT-file Version 4.
- Compare and Merge MAT-files
View and merge changes between two MAT-files.
Fehlersuche
Unexpected Results When Loading Variables Within a Function
If you have a function that loads data from a MAT-file and find that MATLAB does not return the expected results, check whether any variables in the MAT-file share the same name as a MATLAB function.