It uses the variable “nz_total” if the setting “simulink_opts.outputs.ztraj == 1”, but nz_total is not properly defined in the case this condition is true:
{% if problem_class == "OCP" %}
which was my case.
Setting “simulink_opts.outputs.ztraj = 0” solved the problem, but I think a bugfix is needed
I hope this counts as related. When I also tried to set “simulink_opts.outputs.ztraj = 1”, I encountered the following error: “Reason: Variable nz_total not found in context while rendering ‘make_sfun.in.m’”. Adding the line “{% set nz_total = dims.nz * solver_options.N_horizon %}” to “interfaces/acados_template/acados_template/c_templates_tera/matlab_templates/make_sfun.in.m” like you did for “interfaces/acados_template/acados_template/c_templates_tera/matlab_templates/acados_solver_sfun.in.c” seems to do the trick.