Hauptinhalt

Bereichsvariablen und Generieren von Namen

Teilen von Daten zwischen Funktionen oder Workspaces, Generieren von gültigen Variablennamen

Jede Funktion verfügt über ihren eigenen Workspace, der vom Basis-Workspace getrennt ist, der für Skripte und die Befehlszeile vorbehalten ist. Weitere Informationen zur bevorzugten Methode des Datendurchlaufs zwischen Funktionen finden Sie unter Share Data Between Workspaces.

Funktionen

alle erweitern

persistentDefine persistent variable
assigninAssign value to variable in specified workspace
globalDeclare variables as global
mlockPrevent clearing function or script from memory
munlockAllow clearing function or script from memory
mislockedDetermine if function or script is locked in memory
matlab.lang.WorkspaceStore workspace variables (Seit R2025a)
matlab.lang.Workspace.baseWorkspaceStore variables from base workspace (Seit R2025a)
matlab.lang.Workspace.currentWorkspaceStore variables from current workspace (Seit R2025a)
matlab.lang.Workspace.globalWorkspaceStore variables from global workspace (Seit R2025a)
variablesInformation about workspace variables (Seit R2025a)
variableNamesNames of variables in workspace (Seit R2025a)
evaluateAndCaptureEvaluate MATLAB code in specified workspace (Seit R2025a)
isvarnameDetermine if input is valid variable name
matlab.lang.makeUniqueStringsConstruct unique strings from input strings
matlab.lang.makeValidNameConstruct valid MATLAB identifiers from input strings
namelengthmaxMaximum identifier length

Themen

Fehlersuche

Resolve Error: Attempt to Add Variable to a Static Workspace.

Troubleshoot errors when attempting to add variables to nested and anonymous functions. Variables used within nested and anonymous functions must be present in the text of the code. If you add a variable to the workspace of an anonymous function, a nested function, or a function that contains a nested function dynamically, MATLAB issues an error.