To configure a model to run in External mode over WiFi or Serial network:
Open a model that is configured for External mode. For example, open
Communicating with Arduino Mega 2560 Hardware by typing
arduinomega2560_communication
Open the Configuration Parameters dialog box.
Browse to External mode > Communication interface parameter.
WiFi shield: If you are using WiFi
Shield for Wi-Fi connectivity, select WiFi
shield.
If a Simulink® model already uses blocks from the WiFi library, External mode over Wi-Fi® is not supported.
ESP8266: If you are using ESP8266 for
Wi-Fi connectivity, select
Serial.
When running a model in External mode over serial, Simulink generates error if the Hardware Serial
Port parameter is set to Serial 0.
The error is generated because the External mode uses serial port 0
to communicate with the Arduino® board by default. In WiFi properties, set the Hardware Serial Port
parameter to a value other than Serial 0.
Note
External mode with ESP8266 for Arduino Uno is not supported.
MKR1000, MKR WIFI 1010: If you are using
MKR1000 or MKR WIFI 1010 for Wi-Fi connectivity, select
Serial or
WiFi.

Make sure that you have configured the WiFi properties as described in Configure Network Settings for WiFi.
Click Apply.
Your model is configured to run in External mode.
Note
For normal mode and external mode, the IP address you have specified is used, by default.