Hi,
There is the option to edit Matlab’s rc-script. That is .matlab7rc.sh
located in /usr/local/MATLAB/R20XXY/bin
on my Ubuntu 18.04 machine.
At the top of the file, I mimiced the env.sh
script by adding the lines:
export ENV_RUN=true
export ACADOS_INSTALL_DIR="/directory/of/my/acados/installation"
export MATLABPATH=$MATLABPATH:$ACADOS_INSTALL_DIR/external/casadi-matlab/
export MATLABPATH=$MATLABPATH:$ACADOS_INSTALL_DIR/interfaces/acados_matlab_octave/
export MATLABPATH=$MATLABPATH:$ACADOS_INSTALL_DIR/interfaces/acados_matlab_octave/acados_template_mex/
# probably useless
export OCTAVE_PATH=$OCTAVE_PATH:$ACADOS_INSTALL_DIR/external/casadi-octave/
export OCTAVE_PATH=$OCTAVE_PATH:$ACADOS_INSTALL_DIR/interfaces/acados_matlab_octave/
export OCTAVE_PATH=$OCTAVE_PATH:$ACADOS_INSTALL_DIR/interfaces/acados_matlab_octave/acados_template_mex/
MODEL_FOLDER=${MODEL_FOLDER:-"./build"}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ACADOS_INSTALL_DIR/lib:$MODEL_FOLDER
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ACADOS_INSTALL_DIR/interfaces/acados_template/tera_renderer/t_renderer/target/release
This script runs before MATLAB links to the libraries specified in LD_LIBRARY_PATH
. So when I launch MATLAB now, the environment variables are set as required by acados.
Maybe you could add some procedure to acados’ installation that perform above steps automatically / adds the lines to MATLAB’s .matlab7rc.sh
script. Then the procedure of sourcing the env.sh
is not required to be performed by the user.
Andi