If you need it as regular function (requires MatLab version with Compatible Array Sizes for Basic Operations support):
function dig = de2bs(dec, base, isoutputnumerical, pos)
% de2bs(D)
% de2bs(D, BASE)
% de2bs(D, BASE, ISOUTPUTNUMERICAL)
% de2bs(D, BASE, ISOUTPUTNUMERICAL, POS)
%
% de2bs(D)
% Return a binary number corresponding to the non-negative integer D
% (Behaves the same as dec2bin(D) )
%
% de2bs([123,321])
% ans = 001111011
% 101000001
%
% de2bs(D, BASE)
% Return a string of symbols in base BASE corresponding
% to the non-negative integer D.
%
% de2bs(123, 3)
% ans = 011120
% 102220
%
% If BASE is a string then the base is calculated as length(BASE),
% and characters of BASE are used as the symbols for the digits of D.
%
% de2bs (123, "aBc")
% ans = aBBBca
% Baccca
%
% de2bs(D, BASE, ISOUTPUTNUMERICAL)
% By default, ISOUTPUTNUMERICAL is false
%
% de2bs([123,321],16,0)
% ans = 07B
% 141
%
% de2bs([123,321],16,1)
% ans = 0 7 11
% 1 4 1
%
%
% de2bs(D, BASE, ISOUTPUTNUMERICAL, POS)
% POS - optional array of digits positions (like in bitget function)
% By default pos = (ceil( log2(max(dec(:)))/log2(base)) ):-1:1 )
%
% dde2bs([123,321],3,0)
% ans = 011120
% 102220
%
% de2bs([123,321],3,0,8:-2:2)
% ans = 0012
% 0122
%
% See also: dec2base, base2dec, dec2bin, dec2hex.
% parsing input parameters ------------------------------------------
if nargin < 2 base = 2; end
symbols = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (ischar(base)) symbols = base; base = length(symbols); end
if nargin < 3 isoutputnumerical = false; end
max_len = ceil( log2(max(dec(:)))/log2(base));
if nargin < 4 pos = [max_len:-1:1]; end
% Conver decimals into base -----------------------------------------
pbs = [base.^(pos-1)]; % pbs - powers of base
dig = sum(rem(dec(:), base.*pbs) >= permute((1:base-1)'*pbs,[3,2,1]),3); % TODO - with for loop requires less calculations (this is just example with compact code)
if isoutputnumerical == false dig = reshape(symbols(dig+1), size(dig)); end