Main Content

MathWorks.MATLAB.Types.MATLABWorkspace

.NET class to manage interactions with MATLAB base workspace variables

Since R2022b

Description

Class Details

Namespace:

MathWorks.MATLAB.Types
Superclass:IReadOnlyDictionary

Method Summary

Public Methods

dynamic this["varname"]

Get or set the variable varname in the workspace.

int Count

Get the number of variables in the workspace.

System.Collections.Generic.IEnumerable<string> Keys

Get the names of the workspace variables, specified as an enumerable collection.

System.Collections.Generic.IEnumerable<dynamic> Values

Get the values of the workspace variables, specified as an enumerable collection.

bool ContainsKey(string key)

Determine if workspace contains the specified variable.

bool TryGetValue(string key, out dynamic value)

Determine if the specified key exists and get the value.

Exceptions

System.Collections.Generic.KeyNotFoundException

Specifying a variable that does not exist in the MATLAB® base workspace.

System.ArgumentNullExceptionNull string is not a valid argument.

Version History

Introduced in R2022b