Variables de l’espace de travail et fichiers MAT
L’espace de travail contient les variables que vous créez ou importez dans MATLAB à partir de fichiers de données ou d’autres programmes. Vous pouvez afficher et modifier le contenu de l’espace de travail dans le navigateur de l’espace de travail ou la fenêtre de commande. Pour plus d’informations, consultez Create and Edit Variables.
Les variables de l'espace de travail ne sont pas sauvegardées lorsque vous quittez MATLAB. Pour utiliser vos données dans plusieurs sessions, enregistrez-les dans un fichier compressé avec une extension .mat
, appelé fichier MAT. Vous pouvez restaurer les données enregistrées en rechargeant un fichier MAT dans MATLAB. Pour plus d’informations, consultez Save and Load Workspace Variables.
Fonctions
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 | Afficher la valeur d’une variable |
formattedDisplayText | Capture display output as string (depuis 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 |
openvar | Open workspace variable in Variables editor or other graphical editing tool |
workspace | Open Workspace browser to manage workspace |
Rubriques
- Create and Edit Variables
Create, edit, and copy variables in the MATLAB workspace, in the Command Window or using the Workspace browser and Variables editor.
- 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.
- Display Statistics in the Workspace Browser
For each variable or object, the Workspace browser can display statistics such as the min, max, and mean, when relevant.
- Workspace and Variable Preferences
Set preferences for the Workspace browser 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.
Résolution des problèmes
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.