I think I found a solution for my problem now. Basically, I introduce a second MATLAB function block to create and store the values.
Since I found this question a couple of times online, I uploaded an example for the calculation of a moving average using this method.
The disadvantage of my solution is, that the vector size (or time constant) needs to be defined directly inside the fcn block but that's fine for my purpose.
Of course, I'm always open for other suggestions. Maybe someone has a more elegant solution?!