Matlab crashes when when using acados sting options

Hello everyone,

I’m using acados with the Matlab interface, and I’m running into an issue with Matlab crashing often with my code. This code crashes Matlab on both Windows and Linux. Specifically Matlab crashes when the OCP solver is created:

ocp = acados_ocp(ocp_model, ocp_opts);

The code is pretty straightforward, so I’m not sure if I’m making a simple mistake or not?

Here is a zip file that contains the matlab code, as well as a crash report from Matlab.

Thanks!

Hey,

I found that the issue of the crash was the use of Matlab strings instead of char arrays, i.e. “” instead of ‘’.

I now pushed a fix to cast these weird strings into char arrays:

If you get rid of “” and initialize the ocp solver like this:

% initialize ocp
for k = 0:N-1
    ocp.set('z', z0, k)
    ocp.set('x', x, k)
end

it seems to work fine.

Cheers,
Jonathan

1 Like

Hi Jonathan,

I’ve pulled the repo and made the changes you recommended. Everything works really well now. Thanks for the help! I really appreciate it! :slight_smile: