function [X, I] = internal_sort(X, varargin)
% This function is undocumented and will change in a future release.

% internal_sort

% Syntax:
%   [Y, I] = internal_sort(X, dim, direction, options);
%
% Inputs (dlarray):
%   X              Input
%   dim            Sorting dimension (default: first dim > 1)
%   direction      Sorting direction (default: 'ascend')
%   option         NameValue Pairs: MissingPlacement/ComparisonMethod
%                                   (default: 'auto')
% Outputs
%   Y              Sorted dlarray
%   I              Indices of the sorted dlarray

%   Copyright 2023 The MathWorks, Inc.

[X, I] = sort(X, varargin{:});

end