matlab.lang.Workspace.currentWorkspace - Store variables from current workspace - MATLAB (original) (raw)
Main Content
Store variables from current workspace
Since R2025a
Syntax
Description
w = matlab.lang.Workspace.currentWorkspace
creates a workspace object that contains a copy of variables in the current workspace.
Examples
Create a function that uses matlab.lang.Workspace.currentWorkspace
to create a workspace object that stores the variables in the current function workspace.
function wCurrent = exampleFunction(input) localVar = input + 5; wCurrent = matlab.lang.Workspace.currentWorkspace; end
Run exampleFunction
.
wCurrent = exampleFunction(5)
wCurrent = Workspace with variables:
Name Size Class
________ ____ ______
input 1x1 double
localVar 1x1 double
Version History
Introduced in R2025a