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

DeleteWorkspaces v1

../_images/DeleteWorkspaces-v1_dlg.png

DeleteWorkspaces dialog.

Summary

Removes a list of workspaces from memory.

Properties

Name Direction Type Default Description
WorkspaceList Input str list Mandatory A list of the workspaces to delete.

Description

If workspaces in the WorkspaceList exist then it is removed from Mantid.

Usage

Example - Delete using a list of objects

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

DeleteWorkspaces([sample_ws,sample_ws2])

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

Output:

sample_ws exists in mantid: False
sample_ws2 exists in mantid: False

Example - Delete using a string list

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

DeleteWorkspaces("single_value, single_value2")

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

Output:

single_value exists in mantid: False
single_value2 exists in mantid: False

Categories: AlgorithmIndex | Utility\Workspaces