{"id":11140,"date":"2022-03-30T09:11:39","date_gmt":"2022-03-30T09:11:39","guid":{"rendered":"https:\/\/imperix.com\/doc\/?p=11140"},"modified":"2025-11-25T14:30:46","modified_gmt":"2025-11-25T14:30:46","slug":"opc-ua-toolbox-for-matlab-and-simulink","status":"publish","type":"post","link":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink","title":{"rendered":"Making an OPC UA client using MATLAB"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-right-text counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\/#Connecting-to-an-OPC-UA-server-using-MATLAB\" >Connecting to an OPC UA server using MATLAB<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\/#Read-and-write-OPC-UA-variables-using-MATLAB\" >Read and write OPC UA variables using MATLAB<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\/#Enabling-and-disabling-PWM-outputs-using-OPC-UA\" >Enabling and disabling PWM outputs using OPC UA<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\/#Browsing-OPC-UA-variables-using-MATLAB-OPC-Toolbox\" >Browsing OPC UA variables using MATLAB OPC Toolbox<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\/#App-Designer-GUI-as-an-OPC-UA-client\" >App Designer GUI as an OPC UA client<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\/#MATLAB-Industrial-Communication-Toolbox-troubleshooting\" >MATLAB Industrial Communication Toolbox troubleshooting<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\/#MATLAB-opcua-function-%E2%80%9Cnot-enough-input-arguments%E2%80%9D-error\" >MATLAB opcua function &#8220;not enough input arguments&#8221; error<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\/#MATLAB-readValue-%E2%80%9Cindex-exceeds-the-number-of-array-elements-0%E2%80%9D-error\" >MATLAB readValue &#8220;index exceeds the number of array elements (0)&#8221; error<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<p>The <a href=\"https:\/\/fr.mathworks.com\/products\/industrial-communication.html\">Industrial Communication Toolbox Add-On<\/a> for MATLAB and Simulink (formerly OPC Toolbox) allows communicating with an OPC UA server directly from MATLAB. This page explains how to use the Industrial Communication Toolbox to monitor and control an <a href=\"https:\/\/imperix.com\/products\/power-electronic-controllers\/\">imperix controller<\/a> (or a TPI8032) by connecting to its embedded OPC UA server.<\/p>\n\n\n\n<p>Information on the implementation of the OPC UA server within imperix controllers, as well as the list of available variables are provided in <a href=\"https:\/\/imperix.com\/doc\/help\/opc-ua\">PN177<\/a>. Further details on the real time protocols supported by imperix controllers are given in <a href=\"https:\/\/imperix.com\/doc\/help\/real-time-communication-protocols\">PN202<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"760\" height=\"206\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/04\/image-25.png\" alt=\"\" class=\"wp-image-11721\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/04\/image-25.png 760w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/04\/image-25-300x81.png 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><figcaption class=\"wp-element-caption\">Read and write OPC UA variables from MATLAB using the Industrial Communication OPC UA toolbox<\/figcaption><\/figure>\n\n\n\n<p>The Industrial Communication Toolbox can be used in combination with MATLAB App Designer to easily create an Graphical User Interface (GUI). An example is shown below, which is further documented in <a href=\"https:\/\/imperix.com\/doc\/help\/gui-with-matlab-app-designer\">PN130<\/a>. This constitutes a flexible alternative to the developement of a custom GUI within Cockpit using the <a href=\"https:\/\/imperix.com\/doc\/help\/gui-builder-module\">GUI builder<\/a>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"540\" height=\"733\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/04\/image-26.png\" alt=\"\" class=\"wp-image-11722\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/04\/image-26.png 540w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/04\/image-26-221x300.png 221w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><figcaption class=\"wp-element-caption\">Example of custom-made GUI to interact with an imperix controller<\/figcaption><\/figure>\n<\/div>\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">This page provides an overview of the capabilities of the MATLAB Industrial Communication Toolbox OPC UA client. Please refer to the official <a href=\"https:\/\/mathworks.com\/help\/icomm\/unified-architecture.html\">MATLAB Unified Architecture<\/a> documentation for an exhaustive list of available features.<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-connecting-to-an-opc-ua-server-using-matlab\"><span class=\"ez-toc-section\" id=\"Connecting-to-an-OPC-UA-server-using-MATLAB\"><\/span>Connecting to an OPC UA server using MATLAB<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The Industrial Communication Toolbox <code>opcuaserverinfo<\/code> function returns an OPC UA ServerInfo object containing information on the OPC UA server, such as the server description and hostname. The <code>opcua<\/code> function creates an OPC UA client object to which it is possible to <code>connect <\/code>or <code>disconnect<\/code>. The function <code>isConnected <\/code>returns the connection status (0 or 1);<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Matlab\" data-shcb-language-slug=\"matlab\"><span><code class=\"hljs language-matlab\">info = opcuaserverinfo(<span class=\"hljs-string\">'10.10.10.134'<\/span>);\nclient = opcua(info);\nconnect(client);\nisConnected(client);\ndisconnect(client);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Matlab<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">matlab<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Alternatively, the <code>opcua<\/code> function can directly take an IP and port as parameters.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Matlab\" data-shcb-language-slug=\"matlab\"><span><code class=\"hljs language-matlab\">client = opcua(<span class=\"hljs-string\">'10.10.10.134'<\/span>, <span class=\"hljs-number\">4840<\/span>);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Matlab<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">matlab<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">If the function <code>opcuaserverinfo<\/code> works (it returns the target information as shown in the screenshot below) but <code>opcua<\/code> throws a &#8220;not enough input arguments&#8221; error, it is probably due to Windows failing to resolve the hostname. You may need to edit the file <strong>C:\\Windows\\System32\\drivers\\etc\\hosts <\/strong>and manually add the &#8220;hostname\/IP&#8221; pair. The issue is further discussed in the troubleshooting section below.<\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"332\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-4.png\" alt=\"\" class=\"wp-image-11154\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-4.png 803w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-4-300x124.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-4-768x318.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><figcaption class=\"wp-element-caption\">Expected output of the MATLAB opcuaserverinfo function<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"450\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-7.png\" alt=\"\" class=\"wp-image-11157\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-7.png 785w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-7-300x172.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-7-768x440.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><figcaption class=\"wp-element-caption\">Expected output of the MATLAB opcua function<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-read-and-write-opc-ua-variables-using-matlab\"><span class=\"ez-toc-section\" id=\"Read-and-write-OPC-UA-variables-using-MATLAB\"><\/span>Read and write OPC UA variables using MATLAB<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Two steps are required to read or write an OPC UA variable value using the Industrial Communication Toolbox OPC UA client. First, an OPC UA server node object must be created using the <code>findNodeByName<\/code> function. Then simply use the <code>readValue<\/code> of <code>writeValue<\/code> function to read or write the OPC UA variable.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Matlab\" data-shcb-language-slug=\"matlab\"><span><code class=\"hljs language-matlab\"><span class=\"hljs-comment\">% read the B-Box CPU load system variable<\/span>\ncpu_load_node = findNodeByName(client.Namespace, <span class=\"hljs-string\">'CPU load &#91;%]'<\/span>);\nreadValue(client, cpu_load_node);\n\n<span class=\"hljs-comment\">% write to a tunable parameter user variable<\/span>\nwriteValue(client, findNodeByName(client.Namespace, <span class=\"hljs-string\">'Vdc_ref'<\/span>));<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Matlab<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">matlab<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"333\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-13.png\" alt=\"\" class=\"wp-image-11167\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-13.png 788w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-13-300x127.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-13-768x325.png 768w\" sizes=\"auto, (max-width: 788px) 100vw, 788px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-enabling-and-disabling-pwm-outputs-using-opc-ua\"><span class=\"ez-toc-section\" id=\"Enabling-and-disabling-PWM-outputs-using-OPC-UA\"><\/span>Enabling and disabling PWM outputs using OPC UA<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Unfortunately, the MATLAB Industrial Communication Toolbox OPC UA client does not support OPC UA method calls. Therere, the imperix OPC UA methods &#8220;Enable outputs&#8221; and &#8220;Disable outputs&#8221; can not be directly called. The same functionality can however be implemented by using the <a href=\"https:\/\/imperix.com\/doc\/software\/enable-outputs\">enable outputs block<\/a> as shown below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"259\" height=\"60\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/04\/image-30.png\" alt=\"\" class=\"wp-image-11731\"\/><\/figure>\n<\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"834\" height=\"401\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-18.png\" alt=\"\" class=\"wp-image-11172\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-18.png 834w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-18-300x144.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-18-768x369.png 768w\" sizes=\"auto, (max-width: 834px) 100vw, 834px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-browsing-opc-ua-variables-using-matlab-opc-toolbox\"><span class=\"ez-toc-section\" id=\"Browsing-OPC-UA-variables-using-MATLAB-OPC-Toolbox\"><\/span>Browsing OPC UA variables using MATLAB OPC Toolbox<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Instead of explicitly providing the OPC UA variable name with <code>findNodeByName<\/code>, the function <code>browseNamespace <\/code>opens the Browse Name Space containing the list of available OPC UA nodes. When the OK button is clicked, <code>browseNamespace<\/code> returns the OPC UA server node object that can be passed as a parameter to the <code>readValue<\/code> or <code>writeValue <\/code>functions.<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">nodes = browseNamespace(client);\nvalues = readValue(client, nodes);<\/code><\/span><\/pre>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"332\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-9.png\" alt=\"\" class=\"wp-image-11163\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-9.png 502w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-9-300x198.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/figure>\n<\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"240\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-10.png\" alt=\"\" class=\"wp-image-11164\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-10.png 785w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-10-300x92.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-10-768x235.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-310fcd18-8a67-4e35-ae73-c8eafd2e320f\"><span class=\"ez-toc-section\" id=\"App-Designer-GUI-as-an-OPC-UA-client\"><\/span>App Designer GUI as an OPC UA client<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"block-a3bc1683-edb1-4435-b68d-b4bdc0ca1496\">An App Designer GUI can easily be used as an OPC UA client thanks to the Industrial Communication Toolbox. This section presents the main structure of a GUI used as an OPC UA client. For a more detailed tutorial on how to create graphical user interfaces with MATLAB App Designer, please refer to the page <a href=\"https:\/\/imperix.com\/doc\/help\/gui-with-matlab-app-designer\">Graphical User Interface with MATLAB App Designer<\/a>.<\/p>\n\n\n\n<p id=\"block-a3bc1683-edb1-4435-b68d-b4bdc0ca1496\">In the code view of App Designer, the first step for the creation of an OPC UA client is to declare a <code>client <\/code>as a property so that it is&nbsp;accessible to all functions and callbacks within the app.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Matlab\" data-shcb-language-slug=\"matlab\"><span><code class=\"hljs language-matlab\">    <span class=\"hljs-keyword\">properties<\/span> (Access = private)\n        client ;\n    <span class=\"hljs-keyword\">end<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Matlab<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">matlab<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Then, in the GUI&#8217;s startup function (<code>StartupFcn<\/code>), assign an OPC UA client as an <code>opc.ua.client<\/code> object to the previously declared property.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Matlab\" data-shcb-language-slug=\"matlab\"><span><code class=\"hljs language-matlab\">        <span class=\"hljs-comment\">% Code that executes after component creation<\/span>\n        <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">startupFcn<\/span><span class=\"hljs-params\">(app)<\/span><\/span>\n            app.client = opc.ua.Client;\n        <span class=\"hljs-keyword\">end<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Matlab<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">matlab<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Then, a push button with the <code>connect <\/code>and <code>disconnect <\/code>function in its callback can be used to connect and disconnect to\/from the OPC UA server. The server&#8217;s IP address can be entered inside an <code>EditField <\/code>UI for instance.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Matlab\" data-shcb-language-slug=\"matlab\"><span><code class=\"hljs language-matlab\"><span class=\"hljs-comment\">% Button pushed function: ConnectButton<\/span>\n        <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">ConnectButtonPushed<\/span><span class=\"hljs-params\">(app, event)<\/span><\/span>\n\n            <span class=\"hljs-keyword\">if<\/span> isConnected(app.client) == <span class=\"hljs-number\">1<\/span>\n                disconnect(app.client);\n                app.client = opc.ua.Client;\n            <span class=\"hljs-keyword\">else<\/span>\n                ip = app.TargetIPEditField.Value;\n                <span class=\"hljs-keyword\">try<\/span>\n                    info = opcuaserverinfo(ip);\n                    hostname = info.Hostname;\n                    <span class=\"hljs-keyword\">try<\/span>\n                        app.client = opcua(info);\n                        connect(app.client);\n                    <span class=\"hljs-keyword\">catch<\/span>\n                        msgbox({&#91;<span class=\"hljs-string\">'Target '<\/span> ip <span class=\"hljs-string\">' ('<\/span> hostname <span class=\"hljs-string\">') found but failed to connect. '<\/span>];<span class=\"hljs-string\">''<\/span>; ...\n                            &#91;<span class=\"hljs-string\">'Note: due to a limitation of the Industrial Communication Toolbox, you may need to edit the file C:\\Windows\\System32\\drivers\\etc\\hosts to manually add the line \"'<\/span> ip <span class=\"hljs-string\">' '<\/span> hostname <span class=\"hljs-string\">'\"'<\/span>]});\n                    <span class=\"hljs-keyword\">end<\/span>\n                <span class=\"hljs-keyword\">catch<\/span> \n                    msgbox(&#91;<span class=\"hljs-string\">'Failed to connect to '<\/span> ip <span class=\"hljs-string\">'.'<\/span>]);\n                <span class=\"hljs-keyword\">end<\/span>\n            <span class=\"hljs-keyword\">end<\/span>\n        <span class=\"hljs-keyword\">end<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Matlab<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">matlab<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Finally, the aforementioned read\/write methods can be used in the callbacks of timers or UI components to interact with the available OPC UA variable. The code below gives an example of how these methods can be used in the callback of a push button.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"VHDL\" data-shcb-language-slug=\"vhdl\"><span><code class=\"hljs language-vhdl\">        % Button pushed <span class=\"hljs-keyword\">function<\/span>: PrechargebusandactivatePWMButton\n        <span class=\"hljs-keyword\">function<\/span> PrechargebusandactivatePWMButtonPushed(app, event)\n            <span class=\"hljs-keyword\">if<\/span> UserCodeIsRunning(app)\n                activate_cmd_value = readValue(app.client, findNodeByName(app.client.Namespace, <span class=\"hljs-symbol\">'activate<\/span>'));\n                <span class=\"hljs-keyword\">if<\/span> activate_cmd_value == <span class=\"hljs-number\">0<\/span>\n                    writeValue(app.client, findNodeByName(app.client.Namespace, <span class=\"hljs-symbol\">'activate<\/span>'), <span class=\"hljs-number\">1<\/span>);\n                    app.PrechargebusandactivatePWMButton.<span class=\"hljs-literal\">Text<\/span> = <span class=\"hljs-symbol\">'Deactivate<\/span> <span class=\"hljs-keyword\">all<\/span> PWM, <span class=\"hljs-keyword\">open<\/span> relays';\n                <span class=\"hljs-keyword\">else<\/span>\n                    writeValue(app.client, findNodeByName(app.client.Namespace, <span class=\"hljs-symbol\">'activate<\/span>'), <span class=\"hljs-number\">0<\/span>);\n                    app.PrechargebusandactivatePWMButton.<span class=\"hljs-literal\">Text<\/span> = <span class=\"hljs-symbol\">'Precharge<\/span> <span class=\"hljs-keyword\">bus<\/span> <span class=\"hljs-keyword\">and<\/span> activate PWM';\n                <span class=\"hljs-keyword\">end<\/span>\n            <span class=\"hljs-keyword\">end<\/span>\n        <span class=\"hljs-keyword\">end<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">VHDL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">vhdl<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-matlab-industrial-communication-toolbox-troubleshooting\"><span class=\"ez-toc-section\" id=\"MATLAB-Industrial-Communication-Toolbox-troubleshooting\"><\/span>MATLAB Industrial Communication Toolbox troubleshooting<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-matlab-opcua-function-not-enough-input-arguments-error\"><span class=\"ez-toc-section\" id=\"MATLAB-opcua-function-%E2%80%9Cnot-enough-input-arguments%E2%80%9D-error\"><\/span>MATLAB opcua function &#8220;not enough input arguments&#8221; error<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If the function <code>opcuaserverinfo <\/code>works but <code>opcua<\/code> throws the &#8220;not enough input arguments&#8221; error shown below, even when using an IP address, it is probably due to Windows failing to resolve the hostname.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Matlab\" data-shcb-language-slug=\"matlab\"><span><code class=\"hljs language-matlab\">&gt;&gt; client = opcua(<span class=\"hljs-string\">'10.10.10.134'<\/span>, <span class=\"hljs-number\">4840<\/span>)\nError using strncmpi\nNot enough input arguments.\n\nError in opc.ua.Client (line <span class=\"hljs-number\">387<\/span>)\n                        <span class=\"hljs-keyword\">if<\/span> ~strncmpi(this(tI).Hostname, urlParts.Hostname,\n                        <span class=\"hljs-built_in\">numel<\/span>(this(tI).Hostname))\n\nError in opcua (line <span class=\"hljs-number\">43<\/span>)\nuaObj = opc.ua.Client(varargin{:});<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Matlab<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">matlab<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"249\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-5.png\" alt=\"\" class=\"wp-image-11155\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-5.png 783w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-5-300x95.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-5-768x244.png 768w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\" \/><\/figure>\n\n\n\n<p>It comes from a limitation of the Industrial Communication Toolbox OPC UA client. As can be seen in the screenshot below, even when an IP address is directly provided to the <code>opcua<\/code> function, the toolbox will try to connect using the hostname instead.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"772\" height=\"493\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-8.png\" alt=\"\" class=\"wp-image-11158\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-8.png 772w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-8-300x192.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-8-768x490.png 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/figure>\n\n\n\n<p>If <code>opcua<\/code> throws an error, it probably means that Windows failed to resolve the hostname. As shown in the image below, the solution is to edit the file <strong>C:\\Windows\\System32\\drivers\\etc\\hosts <\/strong>and manually add the &#8220;hostname\/IP&#8221; pair.<\/p>\n\n\n\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-warning\" role=\"alert\">You need administrator rights to edit <strong>C:\\Windows\\System32\\drivers\\etc\\hosts<\/strong>.<\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"743\" height=\"509\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-6.png\" alt=\"\" class=\"wp-image-11156\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-6.png 743w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-6-300x206.png 300w\" sizes=\"auto, (max-width: 743px) 100vw, 743px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-matlab-readvalue-index-exceeds-the-number-of-array-elements-0-error\"><span class=\"ez-toc-section\" id=\"MATLAB-readValue-%E2%80%9Cindex-exceeds-the-number-of-array-elements-0%E2%80%9D-error\"><\/span>MATLAB readValue &#8220;index exceeds the number of array elements (0)&#8221; error<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If the readValue function generates a &#8220;index exceeds the number of array elements (0)&#8221; error, but you now that the OPC UA node exists, it may be because the OPC UA client is not up to date and needs to rebrowse the OPC UA nodes. A solution is to <code>disconnect<\/code> and <code>connect<\/code> again as shown in the screenshot below.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"VHDL\" data-shcb-language-slug=\"vhdl\"><span><code class=\"hljs language-vhdl\">&gt;&gt; readValue(findNodeByName(client.Namespace, <span class=\"hljs-symbol\">'my_probe<\/span>'))\nIndex exceeds the number <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-keyword\">array<\/span> elements (<span class=\"hljs-number\">0<\/span>).\n\n<span class=\"hljs-literal\">Error<\/span> <span class=\"hljs-keyword\">in<\/span> opc.ua.Node\/isSameClient (<span class=\"hljs-literal\">line<\/span> <span class=\"hljs-number\">545<\/span>)\n            tf = ~isempty(this(<span class=\"hljs-number\">1<\/span>).Client);\n\n<span class=\"hljs-literal\">Error<\/span> <span class=\"hljs-keyword\">in<\/span> opc.ua.Node\/readValue (<span class=\"hljs-literal\">line<\/span> <span class=\"hljs-number\">802<\/span>)\n            <span class=\"hljs-keyword\">if<\/span> ~isSameClient(nodeList)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">VHDL<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">vhdl<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"390\" src=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-15.png\" alt=\"\" class=\"wp-image-11169\" srcset=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-15.png 788w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-15-300x148.png 300w, https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/image-15-768x380.png 768w\" sizes=\"auto, (max-width: 788px) 100vw, 788px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Industrial Communication Toolbox Add-On for MATLAB and Simulink (formerly OPC Toolbox) allows communicating with an OPC UA server directly from MATLAB. This page explains&#8230;<\/p>\n","protected":false},"author":4,"featured_media":12137,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[3],"tags":[],"software-environments":[103],"provided-results":[],"related-products":[50,31,32,92,166,51,110],"guidedreadings":[],"tutorials":[],"user-manuals":[],"coauthors":[70],"class_list":["post-11140","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-help","software-environments-matlab","related-products-acg-sdk","related-products-b-board-pro","related-products-b-box-rcp","related-products-b-box-micro","related-products-b-box-rcp-3-0","related-products-cpp-sdk","related-products-tpi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>OPC UA client with MATLAB Industrial Communication Toolbox - imperix<\/title>\n<meta name=\"description\" content=\"The Industrial Communication Toolbox for MATLAB and Simulink (formerly OPC Toolbox) allows communicating with an OPC UA server from MATLAB.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OPC UA client with MATLAB Industrial Communication Toolbox - imperix\" \/>\n<meta property=\"og:description\" content=\"The Industrial Communication Toolbox for MATLAB and Simulink (formerly OPC Toolbox) allows communicating with an OPC UA server from MATLAB.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink\" \/>\n<meta property=\"og:site_name\" content=\"imperix\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-30T09:11:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-25T14:30:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/3_2_ratio_PN178.png\" \/>\n\t<meta property=\"og:image:width\" content=\"450\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Beno\u00eet Steinmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Beno\u00eet Steinmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink\"},\"author\":{\"name\":\"Beno\u00eet Steinmann\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/person\\\/a69a3bda75b05d0923cc76d7268cc94f\"},\"headline\":\"Making an OPC UA client using MATLAB\",\"datePublished\":\"2022-03-30T09:11:39+00:00\",\"dateModified\":\"2025-11-25T14:30:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink\"},\"wordCount\":933,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/3_2_ratio_PN178.png\",\"articleSection\":[\"Product notes\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink\",\"name\":\"OPC UA client with MATLAB Industrial Communication Toolbox - imperix\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/3_2_ratio_PN178.png\",\"datePublished\":\"2022-03-30T09:11:39+00:00\",\"dateModified\":\"2025-11-25T14:30:46+00:00\",\"description\":\"The Industrial Communication Toolbox for MATLAB and Simulink (formerly OPC Toolbox) allows communicating with an OPC UA server from MATLAB.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink#primaryimage\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/3_2_ratio_PN178.png\",\"contentUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/3_2_ratio_PN178.png\",\"width\":450,\"height\":300},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/help\\\/opc-ua-toolbox-for-matlab-and-simulink#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Knowledge base\",\"item\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Product notes\",\"item\":\"https:\\\/\\\/imperix.com\\\/doc\\\/category\\\/help\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Making an OPC UA client using MATLAB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#website\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\",\"name\":\"imperix\",\"description\":\"power electronics\",\"publisher\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/imperix.com\\\/doc\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#organization\",\"name\":\"imperix\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/imperix_logo.png\",\"contentUrl\":\"https:\\\/\\\/imperix.com\\\/doc\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/imperix_logo.png\",\"width\":350,\"height\":120,\"caption\":\"imperix\"},\"image\":{\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/imperix.com\\\/doc\\\/#\\\/schema\\\/person\\\/a69a3bda75b05d0923cc76d7268cc94f\",\"name\":\"Beno\u00eet Steinmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/22a9252907f853f91d07b143dfcc84f6ec0cc31f6b72408b503a7026eed5b109?s=96&d=mm&r=g3b3f3d8e66019ebcb2848094940b98c0\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/22a9252907f853f91d07b143dfcc84f6ec0cc31f6b72408b503a7026eed5b109?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/22a9252907f853f91d07b143dfcc84f6ec0cc31f6b72408b503a7026eed5b109?s=96&d=mm&r=g\",\"caption\":\"Beno\u00eet Steinmann\"},\"description\":\"Benoit is an embedded systems expert and the leader of software and firmware developments at imperix. On the knowledge base, he is the author of numerous software reference documents.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/benoit-steinmann\\\/\"],\"url\":\"https:\\\/\\\/imperix.com\\\/doc\\\/author\\\/steinmann\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OPC UA client with MATLAB Industrial Communication Toolbox - imperix","description":"The Industrial Communication Toolbox for MATLAB and Simulink (formerly OPC Toolbox) allows communicating with an OPC UA server from MATLAB.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink","og_locale":"en_US","og_type":"article","og_title":"OPC UA client with MATLAB Industrial Communication Toolbox - imperix","og_description":"The Industrial Communication Toolbox for MATLAB and Simulink (formerly OPC Toolbox) allows communicating with an OPC UA server from MATLAB.","og_url":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink","og_site_name":"imperix","article_published_time":"2022-03-30T09:11:39+00:00","article_modified_time":"2025-11-25T14:30:46+00:00","og_image":[{"width":450,"height":300,"url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/3_2_ratio_PN178.png","type":"image\/png"}],"author":"Beno\u00eet Steinmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Beno\u00eet Steinmann","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink#article","isPartOf":{"@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink"},"author":{"name":"Beno\u00eet Steinmann","@id":"https:\/\/imperix.com\/doc\/#\/schema\/person\/a69a3bda75b05d0923cc76d7268cc94f"},"headline":"Making an OPC UA client using MATLAB","datePublished":"2022-03-30T09:11:39+00:00","dateModified":"2025-11-25T14:30:46+00:00","mainEntityOfPage":{"@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink"},"wordCount":933,"commentCount":0,"publisher":{"@id":"https:\/\/imperix.com\/doc\/#organization"},"image":{"@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink#primaryimage"},"thumbnailUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/3_2_ratio_PN178.png","articleSection":["Product notes"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink#respond"]}]},{"@type":"WebPage","@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink","url":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink","name":"OPC UA client with MATLAB Industrial Communication Toolbox - imperix","isPartOf":{"@id":"https:\/\/imperix.com\/doc\/#website"},"primaryImageOfPage":{"@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink#primaryimage"},"image":{"@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink#primaryimage"},"thumbnailUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/3_2_ratio_PN178.png","datePublished":"2022-03-30T09:11:39+00:00","dateModified":"2025-11-25T14:30:46+00:00","description":"The Industrial Communication Toolbox for MATLAB and Simulink (formerly OPC Toolbox) allows communicating with an OPC UA server from MATLAB.","breadcrumb":{"@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink#primaryimage","url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/3_2_ratio_PN178.png","contentUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2022\/03\/3_2_ratio_PN178.png","width":450,"height":300},{"@type":"BreadcrumbList","@id":"https:\/\/imperix.com\/doc\/help\/opc-ua-toolbox-for-matlab-and-simulink#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Knowledge base","item":"https:\/\/imperix.com\/doc\/"},{"@type":"ListItem","position":2,"name":"Product notes","item":"https:\/\/imperix.com\/doc\/category\/help"},{"@type":"ListItem","position":3,"name":"Making an OPC UA client using MATLAB"}]},{"@type":"WebSite","@id":"https:\/\/imperix.com\/doc\/#website","url":"https:\/\/imperix.com\/doc\/","name":"imperix","description":"power electronics","publisher":{"@id":"https:\/\/imperix.com\/doc\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/imperix.com\/doc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/imperix.com\/doc\/#organization","name":"imperix","url":"https:\/\/imperix.com\/doc\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/imperix.com\/doc\/#\/schema\/logo\/image\/","url":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/imperix_logo.png","contentUrl":"https:\/\/imperix.com\/doc\/wp-content\/uploads\/2021\/03\/imperix_logo.png","width":350,"height":120,"caption":"imperix"},"image":{"@id":"https:\/\/imperix.com\/doc\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/imperix.com\/doc\/#\/schema\/person\/a69a3bda75b05d0923cc76d7268cc94f","name":"Beno\u00eet Steinmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/22a9252907f853f91d07b143dfcc84f6ec0cc31f6b72408b503a7026eed5b109?s=96&d=mm&r=g3b3f3d8e66019ebcb2848094940b98c0","url":"https:\/\/secure.gravatar.com\/avatar\/22a9252907f853f91d07b143dfcc84f6ec0cc31f6b72408b503a7026eed5b109?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/22a9252907f853f91d07b143dfcc84f6ec0cc31f6b72408b503a7026eed5b109?s=96&d=mm&r=g","caption":"Beno\u00eet Steinmann"},"description":"Benoit is an embedded systems expert and the leader of software and firmware developments at imperix. On the knowledge base, he is the author of numerous software reference documents.","sameAs":["https:\/\/www.linkedin.com\/in\/benoit-steinmann\/"],"url":"https:\/\/imperix.com\/doc\/author\/steinmann"}]}},"_links":{"self":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/11140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/comments?post=11140"}],"version-history":[{"count":58,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/11140\/revisions"}],"predecessor-version":[{"id":37546,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/posts\/11140\/revisions\/37546"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/media\/12137"}],"wp:attachment":[{"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/media?parent=11140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/categories?post=11140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/tags?post=11140"},{"taxonomy":"software-environments","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/software-environments?post=11140"},{"taxonomy":"provided-results","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/provided-results?post=11140"},{"taxonomy":"related-products","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/related-products?post=11140"},{"taxonomy":"guidedreadings","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/guidedreadings?post=11140"},{"taxonomy":"tutorials","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/tutorials?post=11140"},{"taxonomy":"user-manuals","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/user-manuals?post=11140"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/imperix.com\/doc\/wp-json\/wp\/v2\/coauthors?post=11140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}