\(\renewcommand\AA{\unicode{x212B}}\)

DeleteWorkspace v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Removes a workspace from memory.

See Also

DeleteWorkspaces

Properties

Name

Direction

Type

Default

Description

Workspace

Input

Workspace

Mandatory

Name of the workspace to delete.

Description

If the input workspace exists then it is removed from Mantid.

Usage

Example - Delete using a handle

# A small test workspace, with sample_ws as the handle
sample_ws = CreateSingleValuedWorkspace(5.0)

DeleteWorkspace(sample_ws)

print("sample_ws exists in mantid: {}".format("sample_ws" in mtd))

Output:

sample_ws exists in mantid: False

Example - Delete using a string

# A small test workspace, with sample_ws as the handle
CreateSingleValuedWorkspace(5.0, OutputWorkspace="single_value")

DeleteWorkspace("single_value")

print("single_value exists in mantid: {}".format("single_value" in mtd))

Output:

single_value exists in mantid: False

Categories: AlgorithmIndex | Utility\Workspaces

Source

C++ header: DeleteWorkspace.h

C++ source: DeleteWorkspace.cpp