That is expected behavior. I don't know why it was designed that way. To avoid the problem, do either one of these:
- Create the variable in Model workspace, it will be saved with the model.
- Create the variable in a Simulink Data Dictionary, it will be saved to a .sldd file.
- Save the workspace variable to a .mat file before closing MATLAB. Next time, load the .mat file first.
- Export the workspace variable to a .m file before closing MATLAB. Next time, run the .m file first.