How to Resolve MATLAB Crashes with Simulink Support Package for Raspberry Pi Due to Locale Settings?

23 views (last 30 days)
MATLAB crashes with dump:
Assertion in struct mxArray_tag *__cdecl `anonymous-namespace'::MxCreateStringNCharsT_safe<unsigned char>::operator ()(const char *,const unsigned char *,unsigned __int64) const at B:\matlab\foundation\matrix\src\matrix\array2.cpp line 495: mxCreateString called with non-UTF-8 input:

Accepted Answer

Sutanu Maiti
Sutanu Maiti on 21 Nov 2023
If you are using the Simulink support package for Raspberry Pi and encountering crashes in MATLAB when creating a Raspberry Pi object, running a Simulink model in connected IO, Monitor and Tune mode, or deploying a model to the Raspberry Pi, the issue may be related to the Locale settings on your Raspberry Pi.
MATLAB requires the "UTF-8" charset to communicate properly with the Raspberry Pi over SSH. If the Raspberry Pi is set to use a different charset, MATLAB will crash when it receives characters that it does not support.
Identifying the Issue:
You can confirm that the crash is due to Locale settings by inspecting the crash dump. If the crash dump contains the following lines, the solution provided here should resolve your issue:
- `mxCreateString called with non-UTF-8 input: `
- `supportpackages\shared_linuxservices\+matlabshared\+internal\private\ssh2client_mex`
Solution:
To fix this issue, you need to change the Locale settings on your Raspberry Pi to use the "UTF-8" charset. Follow these steps:
1. Connect to your Raspberry Pi using a monitor, keyboard, and mouse, or via a VNC session to access the desktop environment remotely.
2. On the Raspberry Pi desktop, click on the **Menu** button in the top-left corner of the screen.
3. Navigate to **Preferences** and then select **Raspberry Pi Configuration**.
4. In the configuration tool, go to the **Localization** tab.
5. Here, you will find options to set the Locale, Timezone, Keyboard, and Wi-Fi Country. Click on the **Set Locale...** button to change the character set.
6. Make sure to select a Locale that ends with **.UTF-8** (e.g., `en_US.UTF-8` for English, United States).
7. After selecting the correct UTF-8 Locale, click **OK** to apply the changes.
8. You may be prompted to reboot your Raspberry Pi for the changes to take effect. Save any work and reboot the Pi.
9. Once your Raspberry Pi restarts, try reconnecting it with MATLAB and running your Simulink model again. The issue should now be resolved, and MATLAB should no longer crash during SSH sessions to the Pi.
Below is a screenshot that guides you through the menu navigation to reach the Raspberry Pi configuration settings:
By ensuring that your Raspberry Pi's Locale is set to use the UTF-8 charset, you can prevent MATLAB from crashing and continue working with your Simulink models seamlessly.
If the problem persists, or if you have further questions, please do not hesitate to reach out to technical support for additional support.

More Answers (0)

Categories

Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!