GET_UID tell UID (numeric) of current user

Contents

Inputs

Outputs

function [i, b] = get_uid(backend)
if nargin < 1
  backend = {'dotnet', 'python', 'perl'};
else
  backend = cellstr(backend);
end

i = [];

for j = 1:numel(backend)
  b = backend{j};
  switch b
    case 'dotnet'
      i = stdlib.dotnet.get_uid();
    case 'python'
      if stdlib.matlabOlderThan('R2022a'), continue, end
      i = stdlib.python.get_uid();
    case 'perl'
      i = stdlib.perl.get_uid();
    otherwise
      error('stdlib:get_uid:ValueError', 'Unknown backend: %s', b)
  end

  if ~isempty(i)
    return
  end
end

end

%!test
%! mustBeInteger(stdlib.get_uid())