Every signal that's represented as a vector or a matrix in Matlab is already quantized. You can't really represent an analog signal in Matlab: once it's list of numbers, it's discrete in time and in amplitude.
This being said, Matlab's default data type (double) has an extremely low quantization error (-300 dB or thereabouts) so for most practical applications this is "good enough".
If you want to quantize to a different data type you can simply scale and round. For example:
%% 1kHz sine wave quantized to 16 bits
% Buid the sine wave
fs = 48000; % sample rate
nx = 1024; % length in samples;
x = sin(2*pi*1000/fs*(0:nx-1)');
% quantize to 16-bits
fullScale = 2^(16-1)-1;
xq = int16(round(fullScale*x));
% calculate the quantization error
xerr = double(xq)/fullScale-x;
fprintf('Quantization Error = %6.2fdB\n',10*log10(mean(xerr.^2)./mean(x.^2)));
You can use build-in functions for this, but this can easily be done manually and this way you learn more about the process and can adapt it too your needs. In this example you can calculate the quantization error directly.
This example uses a uniform quantizer which is by far the most common type of quantization. However there are non-uniform quantizers (like optimal quantizers) as well and that's where functions like
quantiz come in handy.