This page shows how to use the Yaskawa SDK from Matlab, to read and control a Yaskawa Motoman controller from a Matlab script. Matlab loads the .NET DLL of the SDK with its .NET interface: nothing else is installed, on the PC or on the controller.

## Requirements

| Item            | Supported                                                                                                        |
| --------------- | ---------------------------------------------------------------------------------------------------------------- |
| Windows         | Matlab with the .NET Framework 4.6.2 or later (the default on Windows 10 and 11). Load the `net48` DLL           |
| Linux and macOS | Matlab R2024b or later with the .NET runtime, selected by `dotnetenv("core")`. Not tested by UnderAutomation yet |
| Controllers     | YRC1000 (micro), MOTOMAN NEXT, DX100 / DX200, FS100, ERC / XRC / MRC                                             |

Matlab documents its .NET interface in [Call .NET from MATLAB](https://www.mathworks.com/help/matlab/using-net-libraries-in-matlab.html).

## Load the SDK

1. Download [UnderAutomation.Yaskawa.zip](https://github.com/underautomation/Yaskawa.NET/releases/latest/download/UnderAutomation.Yaskawa.zip) from the latest release of [Yaskawa.NET](https://github.com/underautomation/Yaskawa.NET/releases/latest).
2. On Windows, unblock the zip before you extract it: right click, `Properties`, check `Unblock`.
3. Copy its `net48` folder next to your script.
4. Load the DLL with `NET.addAssembly`, then import the namespaces you use.

**Matlab : MatlabLoadAssembly**
```matlab
%%
% The net48 folder of UnderAutomation.Yaskawa.zip, copied next to this script
dll = fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll');

if ~NET.isNETSupported
    error('No supported .NET Framework found on this computer');
end

% Load the SDK once per Matlab session
NET.addAssembly(dll);

% Import the namespaces you use
import UnderAutomation.Yaskawa.*
import UnderAutomation.Yaskawa.HighSpeedEServer.*
import UnderAutomation.Yaskawa.Common.*
%%
```

`NET.addAssembly` needs an absolute path: `fullfile(pwd, ...)` builds one that works on every operating system. Matlab cannot unload a .NET assembly: restart Matlab to load a new version of the DLL.

On Linux and macOS, Matlab R2024b and later can use the .NET runtime instead of the .NET Framework. Set the environment variable `DOTNET_ROOT` to the folder of the .NET runtime, call `dotnetenv("core")` before `NET.addAssembly`, and load the DLL of the `net8.0` folder. See [dotnetenv](https://www.mathworks.com/help/matlab/ref/dotnetenv.html) in the Matlab documentation.

## First program

**C# : ConnectQuick**
```csharp
using UnderAutomation.Yaskawa;

public class ConnectQuick
{
    static void Main()
    {
        /**/
        var robot = new YaskawaRobot();

        // IP address of the controller, default ports and timeouts
        robot.Connect("192.168.0.1");

        // Every function of the SDK is a method of robot.HighSpeedEServer
        var status = robot.HighSpeedEServer.GetStatusInformation();
        Console.WriteLine($"Servo on: {status.ServoOn}, play mode: {status.Play}");

        robot.Disconnect();
        /**/
    }
}
```

**Python : ConnectQuick**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters

##
robot = YaskawaRobot()

# IP address of the controller, default ports and timeouts
robot.connect(ConnectParameters("192.168.0.1"))

# Every function of the SDK is a method of robot.high_speed_e_server
status = robot.high_speed_e_server.get_status_information()
print(f"Servo on: {status.servo_on}, play mode: {status.play}")

robot.disconnect()
##
```

**Matlab : ConnectQuick**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*

%%
robot = YaskawaRobot();

% IP address of the controller, default ports and timeouts
robot.Connect('192.168.0.1');

status = robot.HighSpeedEServer.GetStatusInformation();
fprintf('Servo on: %d, play mode: %d
', status.ServoOn, status.Play);

robot.Disconnect();
%%
```

The connection parameters (ports, timeouts, ping) are set like in C#:

**C# : Connect**
```csharp
using UnderAutomation.Yaskawa;

public class Connect
{
    static void Main()
    {
        /**/
        var parameters = new ConnectParameters("192.168.0.1");

        // Ping the controller first (default: true)
        parameters.PingBeforeConnect = true;

        // UDP ports of the High Speed Ethernet Server (defaults: 10040 and 10041)
        parameters.HighSpeedEServer.DataPort = 10040;
        parameters.HighSpeedEServer.FilePort = 10041;

        // Time to wait for an answer, in milliseconds
        parameters.HighSpeedEServer.DataTimeoutMilliseconds = 1500;
        parameters.HighSpeedEServer.PowerOnTimeoutMilliseconds = 8000;
        parameters.HighSpeedEServer.FileTimeoutMilliseconds = 4000;

        var robot = new YaskawaRobot();
        robot.Connect(parameters);
        /**/

        robot.Disconnect();
    }
}
```

**Python : Connect**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters

##
parameters = ConnectParameters("192.168.0.1")

# Ping the controller first (default: True)
parameters.ping_before_connect = True

# UDP ports of the High Speed Ethernet Server (defaults: 10040 and 10041)
parameters.high_speed_e_server.data_port = 10040
parameters.high_speed_e_server.file_port = 10041

# Time to wait for an answer, in milliseconds
parameters.high_speed_e_server.data_timeout_milliseconds = 1500
parameters.high_speed_e_server.power_on_timeout_milliseconds = 8000
parameters.high_speed_e_server.file_timeout_milliseconds = 4000

robot = YaskawaRobot()
robot.connect(parameters)
##

robot.disconnect()
```

**Matlab : Connect**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*

%%
parameters = ConnectParameters('192.168.0.1');
parameters.PingBeforeConnect = true;

% UDP ports and timeouts of the High Speed Ethernet Server
parameters.HighSpeedEServer.DataPort = 10040;
parameters.HighSpeedEServer.FilePort = 10041;
parameters.HighSpeedEServer.DataTimeoutMilliseconds = 1500;

robot = YaskawaRobot();
robot.Connect(parameters);
%%

robot.Disconnect();
```

The SDK runs for 30 days without a key. After that, register your license once per Matlab session:

**C# : License**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.License;

public class License
{
    static void Main()
    {
        /**/
        // Register the license once, before the first connection
        YaskawaRobot.RegisterLicense("YourCompanyName", "YOUR_LICENSE_KEY");

        LicenseInfo info = YaskawaRobot.LicenseInfo;

        // Number of trial days remaining
        int? evaluationDaysLeft = info.EvaluationDaysLeft;

        bool licenseValid = info.State == LicenseState.Licensed;

        // A readable description of the current state
        Console.WriteLine(info);

        // Check the license once at startup, rather than catching
        // the exception on every connection
        if (!info.IsLicensed)
        {
            Console.WriteLine(info);
            return;
        }
        /**/

        try
        {
            var robot = new YaskawaRobot();
            robot.Connect("192.168.0.1");
        }
        catch (InvalidLicenseException ex)
        {
            Console.WriteLine(ex.Message);
            Console.WriteLine(ex.LicenseInfo.State);
        }
    }
}
```

**Python : License**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters
from underautomation.yaskawa.license.license_state import LicenseState
from UnderAutomation.Yaskawa.License import InvalidLicenseException

##
# Register the license once, before the first connection.
# The returned object describes the state of the license
info = YaskawaRobot.register_license("YourCompanyName", "YOUR_LICENSE_KEY")

# Number of trial days remaining
evaluation_days_left = info.evaluation_days_left

license_valid = info.state == LicenseState.Licensed

# A readable description of the current state
print(info)

# Check the license once at startup, rather than catching
# the exception on every connection
if not info.is_licensed:
    print(info)
    raise SystemExit(0)
##

try:
    robot = YaskawaRobot()
    robot.connect(ConnectParameters("192.168.0.1"))
except InvalidLicenseException as ex:
    # The exception comes from the .NET runtime, so its members keep their original names
    print(ex.Message)
    print(ex.LicenseInfo.State)
```

**Matlab : License**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*

%%
% Register the license once, before the first connection
YaskawaRobot.RegisterLicense('YourCompanyName', 'YOUR_LICENSE_KEY');

info = YaskawaRobot.LicenseInfo;

% A readable description of the current state
disp(char(info.ToString()));

% Check the license once at startup
if ~info.IsLicensed
    error(char(info.ToString()));
end
%%
```

## From .NET to Matlab

The names of the classes, methods and properties are the .NET names of the other pages. The C# samples of the documentation translate line by line, with these rules:

| .NET                                     | Matlab                                                        |
| ---------------------------------------- | ------------------------------------------------------------- |
| `new YaskawaRobot()`                     | `YaskawaRobot()`, after `import UnderAutomation.Yaskawa.*`    |
| `"192.168.0.1"`                          | `'192.168.0.1'`, a char vector                                |
| `GetSystemParameter(type, 29, group: 0)` | `GetSystemParameter(type, 29, 0)`: no named arguments         |
| An optional argument, like `commandtype` | Pass every argument. `[]` passes `null`                       |
| `short[]`, `int[]`, `float[]` returned   | A .NET array: `double(values)` converts it to a Matlab vector |
| `short[]` expected                       | A Matlab vector of the same type: `int16([10, 20])`           |
| `float[]` expected                       | `single([1.5, 2])`                                            |
| `ushort` group of `ReadIO`               | `uint16(1)`                                                   |
| `values[0]`                              | `values(1)`: Matlab indexes .NET arrays from 1                |
| An enumeration value, like `p.DataType`  | `char(p.DataType)` gives its name                             |

## Examples

### Status

**C# : StatusRead**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.HighSpeedEServer;

public class StatusRead
{
    static void Main()
    {
        var robot = new YaskawaRobot();
        robot.Connect("192.168.0.1");

        /**/
        RobotStatusData status = robot.HighSpeedEServer.GetStatusInformation();

        // Mode of the controller
        Console.WriteLine($"Teach: {status.Teach}, play: {status.Play}, remote: {status.CommandRemote}");

        // Cycle mode: step, one cycle or automatic (continuous)
        Console.WriteLine($"Step: {status.Step}, cycle: {status.Cycle}, automatic: {status.Automatic}");

        // Execution
        Console.WriteLine($"Running: {status.Running}, servo on: {status.ServoOn}");

        // Hold, from the pendant, from an external signal or from a command
        Console.WriteLine($"Hold: {status.InHoldStatusPendant} {status.InHoldStatusExternally} {status.InHoldStatusByCommand}");

        // Alarm and error
        Console.WriteLine($"Alarm: {status.Alarming}, error: {status.ErrorOccurring}");
        /**/

        robot.Disconnect();
    }
}
```

**Python : StatusRead**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters

robot = YaskawaRobot()
robot.connect(ConnectParameters("192.168.0.1"))

##
status = robot.high_speed_e_server.get_status_information()

# Mode of the controller
print(f"Teach: {status.teach}, play: {status.play}, remote: {status.command_remote}")

# Cycle mode: step, one cycle or automatic (continuous)
print(f"Step: {status.step}, cycle: {status.cycle}, automatic: {status.automatic}")

# Execution
print(f"Running: {status.running}, servo on: {status.servo_on}")

# Hold, from the pendant, from an external signal or from a command
print(f"Hold: {status.in_hold_status_pendant} {status.in_hold_status_externally} {status.in_hold_status_by_command}")

# Alarm and error
print(f"Alarm: {status.alarming}, error: {status.error_occurring}")
##

robot.disconnect()
```

**Matlab : StatusRead**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*
import UnderAutomation.Yaskawa.HighSpeedEServer.*

robot = YaskawaRobot();
robot.Connect('192.168.0.1');

%%
status = robot.HighSpeedEServer.GetStatusInformation();

% Mode, execution and alarm, as Matlab logicals
fprintf('Play: %d, remote: %d
', status.Play, status.CommandRemote);
fprintf('Running: %d, servo on: %d
', status.Running, status.ServoOn);
fprintf('Alarm: %d, error: %d
', status.Alarming, status.ErrorOccurring);
%%

robot.Disconnect();
```

### Position

**C# : PositionCartesian**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.HighSpeedEServer;

public class PositionCartesian
{
    static void Main()
    {
        var robot = new YaskawaRobot();
        robot.Connect("192.168.0.1");

        /**/
        RobotPositionCartesianData position = robot.HighSpeedEServer.GetRobotCartesianPosition();

        // Tool center point in mm, orientation in degrees
        Console.WriteLine($"X={position.X} Y={position.Y} Z={position.Z}");
        Console.WriteLine($"Rx={position.Rx} Ry={position.Ry} Rz={position.Rz}");

        // Frame, tool and posture of the position
        Console.WriteLine($"{position.DataType}, tool {position.ToolNumber}, user frame {position.UserCoordinateNumber}");
        Console.WriteLine(position.Form);
        /**/

        robot.Disconnect();
    }
}
```

**Python : PositionCartesian**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters

robot = YaskawaRobot()
robot.connect(ConnectParameters("192.168.0.1"))

##
p = robot.high_speed_e_server.get_robot_cartesian_position()

# Tool center point in mm, orientation in degrees
print(f"X={p.x} Y={p.y} Z={p.z}")
print(f"Rx={p.rx} Ry={p.ry} Rz={p.rz}")

# Frame, tool and posture of the position
print(f"{p.data_type.name}, tool {p.tool_number}, user frame {p.user_coordinate_number}")
print(p.form)
##

robot.disconnect()
```

**Matlab : PositionCartesian**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*
import UnderAutomation.Yaskawa.HighSpeedEServer.*

robot = YaskawaRobot();
robot.Connect('192.168.0.1');

%%
p = robot.HighSpeedEServer.GetRobotCartesianPosition();

% Tool center point in mm, orientation in degrees
xyz = [p.X, p.Y, p.Z];
rxyz = [p.Rx, p.Ry, p.Rz];
fprintf('X=%.3f Y=%.3f Z=%.3f
', xyz);
%%

robot.Disconnect();
```

**C# : PositionJoints**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.HighSpeedEServer;

public class PositionJoints
{
    static void Main()
    {
        var robot = new YaskawaRobot();
        robot.Connect("192.168.0.1");

        /**/
        RobotPositionIntData joints = robot.HighSpeedEServer.GetRobotJointPosition();

        // One value per axis, in encoder pulses. Index 0 is the S axis
        int[] pulses = joints.Axes;
        Console.WriteLine(string.Join(", ", pulses));

        // The same values, axis by axis
        Console.WriteLine($"S={joints.Axis1} L={joints.Axis2} U={joints.Axis3} R={joints.Axis4} B={joints.Axis5} T={joints.Axis6}");
        /**/

        robot.Disconnect();
    }
}
```

**Python : PositionJoints**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters

robot = YaskawaRobot()
robot.connect(ConnectParameters("192.168.0.1"))

##
joints = robot.high_speed_e_server.get_robot_joint_position()

# One value per axis, in encoder pulses. Index 0 is the S axis
pulses = list(joints.axes)
print(pulses)

# The same values, axis by axis
print(f"S={joints.axis1} L={joints.axis2} U={joints.axis3} R={joints.axis4} B={joints.axis5} T={joints.axis6}")
##

robot.disconnect()
```

**Matlab : PositionJoints**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*
import UnderAutomation.Yaskawa.HighSpeedEServer.*

robot = YaskawaRobot();
robot.Connect('192.168.0.1');

%%
joints = robot.HighSpeedEServer.GetRobotJointPosition();

% A .NET int32 array: convert it to a Matlab vector of pulses
pulses = double(joints.Axes);
disp(pulses(1:6));
%%

robot.Disconnect();
```

### Variables

**C# : VariableNumeric**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.HighSpeedEServer;

public class VariableNumeric
{
    static void Main()
    {
        var robot = new YaskawaRobot();
        robot.Connect("192.168.0.1");

        /**/
        // B000 to B003: byte variables (0 to 255). Read and write an even number of values
        byte[] b = robot.HighSpeedEServer.ReadByte(0, 4).Value;
        robot.HighSpeedEServer.WriteByte(0, new byte[] { 1, 2, 3, 4 });

        // I010 and I011: integer variables (16 bits)
        short[] i = robot.HighSpeedEServer.ReadInteger(10, 2).Value;
        robot.HighSpeedEServer.WriteInteger(10, new short[] { -100, 200 });

        // D000: double integer variable (32 bits)
        int[] d = robot.HighSpeedEServer.ReadDoubleInteger(0, 1).Value;
        robot.HighSpeedEServer.WriteDoubleInteger(0, new[] { 100000 });

        // R005 to R007: real variables (32 bit floating point)
        float[] r = robot.HighSpeedEServer.ReadReal(5, 3).Value;
        robot.HighSpeedEServer.WriteReal(5, new[] { 1.5f, -2.25f, 3f });
        /**/

        robot.Disconnect();
    }
}
```

**Python : VariableNumeric**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters

robot = YaskawaRobot()
robot.connect(ConnectParameters("192.168.0.1"))

##
# B000 to B003: byte variables (0 to 255). Read and write an even number of values
b = list(robot.high_speed_e_server.read_byte(0, 4).value)
robot.high_speed_e_server.write_byte(0, [1, 2, 3, 4])

# I010 and I011: integer variables (16 bits)
i = list(robot.high_speed_e_server.read_integer(10, 2).value)
robot.high_speed_e_server.write_integer(10, [-100, 200])

# D000: double integer variable (32 bits)
d = list(robot.high_speed_e_server.read_double_integer(0, 1).value)
robot.high_speed_e_server.write_double_integer(0, [100000])

# R005 to R007: real variables (32 bit floating point)
r = list(robot.high_speed_e_server.read_real(5, 3).value)
robot.high_speed_e_server.write_real(5, [1.5, -2.25, 3.0])
##

robot.disconnect()
```

**Matlab : VariableNumeric**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*
import UnderAutomation.Yaskawa.HighSpeedEServer.*

robot = YaskawaRobot();
robot.Connect('192.168.0.1');

%%
% I000 to I004: integer variables
i = double(robot.HighSpeedEServer.ReadInteger(0, 5).Value);

% Write I010 and I011: a Matlab vector of the .NET type of the method
robot.HighSpeedEServer.WriteInteger(10, int16([-100, 200]));

% R005 to R007: real variables
r = double(robot.HighSpeedEServer.ReadReal(5, 3).Value);
robot.HighSpeedEServer.WriteReal(5, single([1.5, -2.25, 3]));
%%

robot.Disconnect();
```

### Inputs and outputs

**C# : IoRead**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.HighSpeedEServer;
using UnderAutomation.Yaskawa.Common;

public class IoRead
{
    static void Main()
    {
        var robot = new YaskawaRobot();
        robot.Connect("192.168.0.1");

        /**/
        // 2 groups of general outputs, from group 1: signals #10010 to #10027
        RobotIOData outputs = robot.HighSpeedEServer.ReadIO(IOType.GeneralOutput, 1, 2);

        // One byte per group, one bit per signal: bit 0 is #10010, bit 7 is #10017
        byte group1 = outputs.Value[0];
        bool out10013 = (group1 & (1 << 3)) != 0;

        // The same read, with the number of the first group (1001 for #10010)
        RobotIOData sameOutputs = robot.HighSpeedEServer.ReadIO(1001, 2);

        // 4 groups of general inputs: #00010 to #00047
        RobotIOData inputs = robot.HighSpeedEServer.ReadIO(IOType.GeneralInput, 1, 4);
        /**/

        robot.Disconnect();
    }
}
```

**Python : IoRead**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters
from underautomation.yaskawa.common.io_type import IOType

robot = YaskawaRobot()
robot.connect(ConnectParameters("192.168.0.1"))

##
# 2 groups of general outputs, from group 1: signals #10010 to #10027
outputs = robot.high_speed_e_server.read_io(IOType.GeneralOutput, 1, 2)

# One byte per group, one bit per signal: bit 0 is #10010, bit 7 is #10017
group1 = outputs.value[0]
out10013 = (group1 & (1 << 3)) != 0

# 4 groups of general inputs: #00010 to #00047
inputs = robot.high_speed_e_server.read_io(IOType.GeneralInput, 1, 4)
##

robot.disconnect()
```

**Matlab : IoRead**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*
import UnderAutomation.Yaskawa.HighSpeedEServer.*
import UnderAutomation.Yaskawa.Common.*

robot = YaskawaRobot();
robot.Connect('192.168.0.1');

%%
% 2 groups of general outputs, from group 1: signals #10010 to #10027
outputs = robot.HighSpeedEServer.ReadIO(IOType.GeneralOutput, uint16(1), 2);

% One byte per group, one bit per signal: bit 0 is #10010
bytes = uint8(outputs.Value);
out10013 = bitget(bytes(1), 4);   % bitget counts from 1
%%

robot.Disconnect();
```

### Jobs and alarms

**C# : JobSelectStart**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.HighSpeedEServer;

public class JobSelectStart
{
    static void Main()
    {
        var robot = new YaskawaRobot();
        robot.Connect("192.168.0.1");

        /**/
        // Select the job by its name, without the .JBI extension, at line 0
        robot.HighSpeedEServer.SelectJob("WELD01", 0);

        // Starting needs the play mode, the remote mode and the servo on
        robot.HighSpeedEServer.ServoCommand(OnOffCommandType.Servo, true);
        robot.HighSpeedEServer.StartJob();
        /**/

        robot.Disconnect();
    }
}
```

**Python : JobSelectStart**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters
from underautomation.yaskawa.high_speed_e_server.on_off_command_type import OnOffCommandType

robot = YaskawaRobot()
robot.connect(ConnectParameters("192.168.0.1"))

##
# Select the job by its name, without the .JBI extension, at line 0
robot.high_speed_e_server.select_job("WELD01", 0)

# Starting needs the play mode, the remote mode and the servo on
robot.high_speed_e_server.servo_command(OnOffCommandType.Servo, True)
robot.high_speed_e_server.start_job()
##

robot.disconnect()
```

**Matlab : JobSelectStart**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*
import UnderAutomation.Yaskawa.HighSpeedEServer.*

robot = YaskawaRobot();
robot.Connect('192.168.0.1');

%%
% Select the job by its name, without the .JBI extension, at line 0
robot.HighSpeedEServer.SelectJob('WELD01', 0);

% Starting needs the play mode, the remote mode and the servo on
robot.HighSpeedEServer.ServoCommand(OnOffCommandType.Servo, true);
robot.HighSpeedEServer.StartJob();
%%

robot.Disconnect();
```

**C# : AlarmRead**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.HighSpeedEServer;

public class AlarmRead
{
    static void Main()
    {
        var robot = new YaskawaRobot();
        robot.Connect("192.168.0.1");

        /**/
        // The controller reports up to 4 alarms, the most recent first
        foreach (RobotRecentAlarm which in Enum.GetValues(typeof(RobotRecentAlarm)))
        {
            RobotAlarmData alarm = robot.HighSpeedEServer.GetAlarm(which);

            // Code 0 means that there is no alarm at this position
            if (alarm.Code == 0) continue;

            Console.WriteLine($"{which}: {alarm.Code} {alarm.Text} at {alarm.OccurringTime} (data {alarm.Data}, type {alarm.Type})");
        }
        /**/

        robot.Disconnect();
    }
}
```

**Python : AlarmRead**
```python
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters
from underautomation.yaskawa.high_speed_e_server.robot_recent_alarm import RobotRecentAlarm

robot = YaskawaRobot()
robot.connect(ConnectParameters("192.168.0.1"))

##
# The controller reports up to 4 alarms, the most recent first
for which in RobotRecentAlarm:
    alarm = robot.high_speed_e_server.get_alarm(which)

    # Code 0 means that there is no alarm at this position
    if alarm.code == 0:
        continue

    print(f"{which.name}: {alarm.code} {alarm.text} at {alarm.occurring_time} (data {alarm.data}, type {alarm.type})")
##

robot.disconnect()
```

**Matlab : AlarmRead**
```matlab
NET.addAssembly(fullfile(pwd, 'net48', 'UnderAutomation.Yaskawa.dll'));
import UnderAutomation.Yaskawa.*
import UnderAutomation.Yaskawa.HighSpeedEServer.*

robot = YaskawaRobot();
robot.Connect('192.168.0.1');

%%
% Up to 4 alarms, the most recent first
alarms = [RobotRecentAlarm.Latest, RobotRecentAlarm.SecondLatest, ...
          RobotRecentAlarm.ThirdLatest, RobotRecentAlarm.FourthLatest];

for k = 1:numel(alarms)
    alarm = robot.HighSpeedEServer.GetAlarm(alarms(k));
    if alarm.Code ~= 0
        fprintf('%d %s at %s
', alarm.Code, char(alarm.Text), char(alarm.OccurringTime));
    end
end
%%

robot.Disconnect();
```

## Known limits

- Matlab has no named arguments: pass all the arguments of a .NET method, in order.
- `LoadFile` and `GetFile` take a .NET delegate for the progress. Pass `[]` to skip it.
- An exception of the SDK is a `NET.NetException` in Matlab. Its `ExceptionObject` property holds the .NET exception, with its `Message`.
- Matlab keeps the DLL loaded until it closes.

See also the Matlab pages on the limits of [.NET arrays](https://www.mathworks.com/help/matlab/matlab_external/limitations-to-support-of-net-arrays.html), [.NET methods](https://www.mathworks.com/help/matlab/matlab_external/limitations-to-support-of-net-methods.html) and [.NET enumerations](https://www.mathworks.com/help/matlab/matlab_external/limitations-to-net-enumerations.html).

## What to read next

- [Connect to your robot](/yaskawa/documentation/connect): the settings of the controller and the errors.
- [High Speed Ethernet Server overview](/yaskawa/documentation/high-speed-ethernet-server): the functions of the SDK, one page per topic.
- [Licensing](/yaskawa/documentation/license): the 30 day trial and the license key.