matlab.lang.Workspace.globalWorkspace - Store variables from global workspace - MATLAB (original) (raw)

Main Content

Store variables from global workspace

Since R2025a

Syntax

Description

w = matlab.lang.Workspace.globalWorkspace creates a workspace object that contains a copy of variables in the global workspace.

example

Examples

collapse all

Create a set of variables in the global workspace.

global x y z x = 2; y = false; z = "Goodnight, Moon";

Use matlab.lang.Workspace.globalWorkspace to create a workspace object that stores the variables in the global workspace.

wGlobal = matlab.lang.Workspace.globalWorkspace

wGlobal = Workspace with variables:

     Name          Size     Class 
_______________    ____    _______

x                  1x1     double 
y                  1x1     logical
z                  1x1     string 

Version History

Introduced in R2025a