Even though in this model, the input to the MATLAB function block will be 0 at the first time step and hence 'n' will be initialized to 1, Simulink has no way to assert that. In other words, if the input to the MATLAB Function block is changed such that 'u' is not 0 at the first time step, then 'n' will never be initialized. This is the reason behind this error.
In order to resolve this issue, you should initialize your persistent variable using an 'if' statement with a call to 'isempty'.
For example, in the attached model, the correct way to use a persistent variable 'n' would be:
function y = fcn(u)
Using an 'if' statement with a call to 'isempty' ensures that 'n' is initialized to 1 at the first time step irrespective of the value of 'u'.