Skip to content
Snippets Groups Projects
clearSelection.m 684 B
Newer Older
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')
    if iscell(guiHandle.userSelection)
        cellfun(@delete, guiHandle.userSelection);
    else
        delete(guiHandle.userSelection);
    end
    guiHandle = rmfield(guiHandle, 'userSelection');
%% Remove the selection field from workspace
if (isfield(workspaceStruct, 'userSelection'))
    workspaceStruct = rmfield(workspaceStruct, 'userSelection');