function workspace(NVPairs)
    %WORKSPACE Open Workspace browser to manage workspace
    %   WORKSPACE Opens the Workspace browser with a view of the variables
    %   in the current Workspace.  Displayed variables may be viewed,
    %   manipulated, saved, and cleared.
    %
    %   See also WHOS, OPENVAR, SAVE.

    %   Copyright 1984-2020 The MathWorks, Inc.

    arguments
        % Optional input argument
        NVPairs.Visible (1,1) logical = true
    end

    import matlab.internal.lang.capability.Capability;
    Capability.require(Capability.InteractiveCommandLine);
    if isempty(getenv('Decaf')) && Capability.isSupported(Capability.LocalClient)
        % Java Desktop
        % Check for required level of Java support
        err = javachk('mwt', 'The Workspace browser');
        if (~isempty(err))
            error('MATLAB:workspace:UnsupportedPlatform', err.message);
        end

        % Launch or close the Workspace
        try
            if NVPairs.Visible
                % Call initprefs, which checks for components which have registered context menu
                % actions for certain datatypes
                initprefs;

                com.mathworks.mlservices.MLWorkspaceServices.invoke;
            else
                desktop = com.mathworks.mlservices.MatlabDesktopServices.getDesktop();
                desktop.closeWorkspaceBrowser();
            end
        catch
            error(message('MATLAB:workspace:workspaceFailed'));
        end
    else
        % JS
        wsb = internal.matlab.desktop_workspacebrowser.RemoteWorkspaceBrowser.getInstance;
        if (NVPairs.Visible)
            wsb.showWorkspaceBrowser;
        else
            wsb.hideWorkspaceBrowser;
        end
    end
end
