.. _api_matlab: ==================== MATLAB API Reference ==================== ---- ---- dime ---- .. code:: matlab dime(protocol='ipc', varargin) Creates a new DiME instance using the specified protocol. If no arguments are given, the function will default to using ``ipc`` and ``tmp/dime.sock``. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | protocol | string | The chosen protocol. Must either be ``ipc`` or ``tcp``. | | | | | | | | ``ipc``: The function expects one additional argument - the pathname | | | | of the Unix socket to connect to. | | | | | | | | ``tcp``: The function expects two additional arguments - the | | | | hostname (string) and port (integer) of the socket, in that order. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | varargin | string or string, integer | Additional parameters. Varies based on the protocol chosen. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | dime | The newly created DiME object. | +--------------------------------+--------------------------------------------------------------------+ ------ delete ------ .. code:: matlab delete(obj) Deletes a DiME instance and performs cleanup on the connection. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | obj | dime | The DiME object to be deleted. | +------------------+--------------------------------+-------------------------------------------------------------------------+ ---- join ---- .. code:: matlab dime.join(varargin) Instructs the DiME server to add the client to the specified groups. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | varargin | string, string, ... | A cell array of strings containing the group names for the | | | | client to join. | +------------------+--------------------------------+-------------------------------------------------------------------------+ ----- leave ----- .. code:: matlab dime.leave(varargin) Instructs the DiME server to remove the client from the specified group. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | varargin | string, string, ... | A cell array of strings containing the group names for the | | | | client to leave. | +------------------+--------------------------------+-------------------------------------------------------------------------+ ---- send ---- .. code:: matlab dime.send(name, varargin) Sends one or more variables to the specified group. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | name | string | The name of the group to send the variables to. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | varargin | string, string, ... | The names of the variables being sent. | +------------------+--------------------------------+-------------------------------------------------------------------------+ ------ send_r ------ .. code:: matlab dime.send_r(name, varargin) Sends one or more variables passed as either a struct or as key-value pairs to the specified group. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | name | string | The name of the group to send the variables to. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | varargin | cell array | A single argument: a struct whose field names are variable names and | | | | values are the variables themselves OR two or more arguments | | | | alternating between strings specifying the variable names and arbitrary | | | | values representing the variables (similar to the struct constructor | | | | with one or more initial fields) | +------------------+--------------------------------+-------------------------------------------------------------------------+ --------- broadcast --------- .. code:: matlab dime.broadcast(varargin) Sends one or more variables to all other clients. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | varargin | string, string, ... | The names of the variables being sent. | +------------------+--------------------------------+-------------------------------------------------------------------------+ ----------- broadcast_r ----------- .. code:: matlab dime.broadcast_r(varargin) Sends one or more variables to all other clients. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | varargin | string, string, ... | A single argument: a struct whose field names are variable names and | | | | values are the variables themselves OR two or more arguments | | | | values representing the variables (similar to the struct constructor | | | | with one or more initial fields) | +------------------+--------------------------------+-------------------------------------------------------------------------+ ---- sync ---- .. code:: matlab dime.sync(n) Requests all variables that have been sent to this client by other clients. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | n | scalar | Number of variables to retrieve from the server. Retrieves all | | | | variables if left unspecified or set to a negative value. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | struct | A struct of the retrieved variable names and their | | | corresponding values. | +--------------------------------+--------------------------------------------------------------------+ ------ sync_r ------ .. code:: matlab dime.sync_r(n) Requests all variables that have been sent to this client by other clients. Does not access the workspace. +-----------------------------------------------------------------------------------------------------------------------------+ | Parameters | +==================+================================+=========================================================================+ | Name | Type | Description | +------------------+--------------------------------+-------------------------------------------------------------------------+ | n | scalar | Number of variables to retrieve from the server. Retrieves all | | | | variables if left unspecified or set to a negative value. | +------------------+--------------------------------+-------------------------------------------------------------------------+ | +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | struct | A struct of the retrieved variable names and their | | | corresponding values. | +--------------------------------+--------------------------------------------------------------------+ ---- wait ---- .. code:: matlab dime.wait() Requests that the server sends a message to the client once a message has been received for said client. This call will block the current thread until the message is received. ------- devices ------- :: dime.devices() Requests a list of all named, nonempty groups from the server. +-----------------------------------------------------------------------------------------------------+ | Returns | +================================+====================================================================+ | Type | Description | +--------------------------------+--------------------------------------------------------------------+ | {string, string, ...} | A cell array containing names of all the groups connected to the | | | DiME server. | +--------------------------------+--------------------------------------------------------------------+