File Exchange

image thumbnail

Simulink-Xplane10 Communication Via UDP

version (83.3 KB) by Mohamed Abdelkader Zahana
Communication between MATLAB/Simulink and X-Plane 10 via UDP


Updated 01 Nov 2015

View License

These Simulink models allow communication between MATLAB/Simulink and X-Plane10. This can be used to test control designs, that are implemented in MATLAB/Simulink, in a flight simulator, specifically X-Plane 10.
It is tested successfully on both Mac OS 10.8 and Windows platforms.
Three files are included:
1- Setup model: sends commands to x-plane via UDP to choose/tell what data x-plane 10 should spit out. You can choose as many data indices as available in the 'Data Input & Output' tab in x-plane 10.
2- Send model: Sends commands to control surfaces only via UDP.
3- Get model: receives data that was chosen by the 'setup model' from x-plane 10

Cite As

Mohamed Abdelkader Zahana (2020). Simulink-Xplane10 Communication Via UDP (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (29)


Please can it work with X-Plane 11?

Hitman Martini

Victor Turcato

sodisetty sarath

how to connect xplane and Matlab if both are running in different computers and they are connected using LAN?

Irfan Shaik


Hi Mo! thanks for sharing this file. although I can see that on xplane says sending and receiving data, my scopes cannot plot any response in other words I think it is connected but there are no sharing data and could you explain what is the use of xplane setup file please. your help would be appreciated :)

Ben Polzine

Mehmet, It's been a while since I worked on this but I used to run a simulator that did just that. We had a 6dof model that calculated position updates to the plane in x-plane and then UDP'd the new position out of Simulink to a python script we were running. This script would take the updated position and using XPlane datarefs to simply set the new position of the aircraft. I haven't looked at this model yet, but you could try to approach it that way if this isn't working.

Mehmet Can Sen

Hi, first of all thanks for documents. I have a question. I already have 6dof model and i want to use x-plane only for visual interface. so, i want to send 'pitch, roll, heading, lattitude, longitude, altitude' datas to x-plane, but i couldnt adress these datas to xplane. Can you tell me how can i change control surface datas with those datas i mentioned above. Thanks again :)

Alireza Ghaderi

does it work with xplane 11?

Lei Zhang

Very grateful for your very helpful work!
I have a little problem when i use the 'send data to xplane'.,I can send pitch、roll、heading、throttle、velocity、altitude,but i can't send lontitude/latitude to change the value。
Thanks again for your greatful work!!!

Pranjal Biswas

Also while receiving data, the block given is truncating a lot of data packets. This was a issue which has troubled me a lot. Please do rectify and optimize it.

Pranjal Biswas

Author please try to remove the limitation on the index values whos data can be received from X-Plane. Apparently I cant read data from index values higher than 30, as it shows up error with the m-file used in Data Receive block.

Larasmoyo Nugroho

hi guys.. do you know how to input 'keystroke' to xplane via simulink ? .. for example key "G" is for landing gear..

duong van truong

hello everybody! how can I get the code, I tried to find but I could not...please

D' Zu

Hello, anybody?
I have 10 Warnings in command window, when I open frontwheelcontrol.slx:

"Warning: In instantiating linked block 'FrontwheelControl/PID roll' : PID 1dof block (mask) does not have a
parameter named 'DifferentiatorICPrevScaledInput'
In general\private\openmdl at 12
In general\private\openslx at 9
In open at 158
In uiopen at 167 "

How can I fix it?


shuhan xu

Very grateful for your very helpful work!
I have a little problem when i use the 'get data from xplane'. Every time i received all zeros after running it. Why i can't get the data?
And also, how can i make the simulink and Xplane in the same "time"? Matlab runs more quickly than Xplane...
Thanks again for your greatful work!!!

Sameh Mostafa

can i have the complier name or link please
i cant find it any where

You need to associate your matlab with a compiler.

Sameh Mostafa

many thanks for uploading the files
i get this error
Error using mex
No supported compiler or SDK was found. For options, visit

It is not tested on Xplane 9. This is because there are modifications in the UDP protocol between version 9 & 10.

Matteo Diana

does anyone know if it works also on x-plane 9?

Hi Belle Seicin. follow the following steps:
1- run x-plane 10
2- open simulink
3- run 'setup_xplane' simulink model
4- to get data from x-plane 10, use the 'commands_to_xplane10' model
5- to get data from x-plane 10, use 'getData_from_xplane10' model

NOTE: if you are running both in the same PC, use the localhost IP address, for both Local address and remote address, which is

Ahmed Maruf

Hi i need help with about UDP. Is my matlab need to SDK compiler for that.

Belle Seicin

hye..can anyone help me on how to get data from the Xplane via atlab..i have zero knowledge about this thing

I updated with the new version. So, you can download it right away.

For some reason, I cannot update the new files. So, kindly, contact me for updated version.

Bilal Siddiqui

I found it to be very useful. One question though. Simulink is running very slow. 5 sec of simulation time consumes 30 sec real time. How can we use the simulator as the plant for control applications made in simulink?

Yogananda Jeppu

I have found this UDP very useful as it is very configurable. I could adapt it to a helicopter X-planes model and set the various parameters like rotor rpm, pitch etc. Getting the data back is also very easy and I could close the loop on an X-planes helicopter model using Simulink. Thank you.


- Fixed an error in the getData model
- Added a sampleTime field in the getData model in order to control the frequency of receiving data
- Added a PID example for takeoff control ( keep the plane in straight line during takeoff).


MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Real-Time Pacer for Simulink