From 87672e132b82476c06ce566370bfe9b6e1609efb Mon Sep 17 00:00:00 2001 From: Jason Watkins Date: Mon, 29 Jun 2015 12:45:36 -0700 Subject: [PATCH] Added MATLAB monitor example. --- MATLAB/MonitorExample/MonitorExample.m | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 MATLAB/MonitorExample/MonitorExample.m diff --git a/MATLAB/MonitorExample/MonitorExample.m b/MATLAB/MonitorExample/MonitorExample.m new file mode 100644 index 0000000..fa42115 --- /dev/null +++ b/MATLAB/MonitorExample/MonitorExample.m @@ -0,0 +1,20 @@ +%% X-Plane Connect MATLAB Example Script +% This script demonstrates how to read and write data to the XPC plugin. +% Before running this script, ensure that the XPC plugin is installed and +% X-Plane is running. +%% Import XPC +clear all; +addpath('../') +import XPlaneConnect.* + +Socket = openUDP(); +while 1 + posi = getPOSI(1, Socket); + ctrl = getCTRL(1, Socket); + + fprintf('Loc: (%4f, %4f, %4f) Aileron:%2f Elevator:%2f Rudder:%2f\n', ... + posi(1), posi(2), posi(3), ctrl(2), ctrl(1), ctrl(3)); + + pause(0.1); +end +closeUDP(Socket); \ No newline at end of file