Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

Variables

Share data between functions or workspaces, generate valid variable names

Functions

isvarname Determine if input is valid variable name
matlab.lang.makeUniqueStrings Construct unique strings from input strings
matlab.lang.makeValidName Construct valid MATLAB identifiers from input strings
namelengthmax Maximum identifier length
persistent Define persistent variable
mlock Prevent clearing function from memory
munlock Allow clearing functions from memory
mislocked Determine if function is locked in memory
assignin Assign value to variable in specified workspace
global Declare variables as global

Examples and How To

Share Data Between Workspaces

There are several ways to share variables between workspaces or allow them to persist between function executions, including passing arguments and using nested functions or persistent variables.

Check Variable Scope in Editor

Use MATLAB® function and variable highlighting features to identify when and where your code uses a particular function or variable.

Concepts

Variable Names

Create valid variable names and avoid potential naming conflicts.

Base and Function Workspaces

The base workspace stores variables that you create at the command line or that a script creates when you run it from the command line or Editor. To protect the integrity of the data, every function has its own workspace that is separate from the base workspace and all other workspaces.

Was this topic helpful?