Seems like you are trying to send a too big amount of data from Raspberry to MATLAB in External Mode, so you get lost connection to target.
You can check this proposition. When the error occures go to Code->External Mode Control Panel in your Simulink model window and press the Connect button (see the picture 1 below).
If after this action simulation will continue press the Arm Trigger button to continue recieve signals from target.
To solve your problem and get rid of error press Disarm Trigger to stop recieve signals and then press Signal & triggering... button and in window that appears turn off redundant signals (picture 2).
Also a good practice is to slightly change your model. Use Rate Transition blocks before Scopes that you use to collect data from target with a view to enlarge signal sample time and decrease the load on your data channel.
And the last advice is to close all your Scopes when starting simulation in External Mode because an open Scope window can slow down your simulation that cause a loss of connection to the target. Also you can change Solver settings in Model Configuration Parameters to speed up a simulation.
Picture 1
Picture 2