function [guiHandle, workspaceStruct] = clearSelection(pGuiHandle, pWorkspaceStruct) %CLEARSELECTION If the fields in the given parameters are available, they will be deleted. % guiHandle = pGuiHandle; workspaceStruct = pWorkspaceStruct; %% Remove selection from gui if isfield(guiHandle, 'userSelection') delete(guiHandle.userSelection); guiHandle = rmfield(guiHandle, 'userSelection'); end %% Remove the selection field from workspace if (isfield(workspaceStruct, 'userSelection')) workspaceStruct = rmfield(workspaceStruct, 'userSelection'); end end