What have you tried and which problems occur?
function YourFcn(Value)
% Initialize the buffer on demand:
persistent Buffer BufferIndex
MaxBufferLen = 19;
if isempty(BufferIndex) % First run
BufferIndex = 1;
% Pre-allocation if possible: Buffer = nan(1, MaxBufferLen)
end
% Store the current value:
Buffer(BufferIndex) = Value;
% Increase and restart the index:
BufferIndex = mod(BufferIndex, MaxBufferLen) + 1