Why do I get a "Check if hostname can be resolved" or "Not enough input arguments" error when connecting to an OPC UA server from MATLAB?
2 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2024-9-13
回答: MathWorks Support Team
2024-9-13
When establishing a connection to an OPC UA server, MATLAB shows the following error in R2022b and earlier:
uaclient = opcua('12.34.56.789')
Error using strncmpi
Not enough input arguments.
Error in opc.ua.Client (line 387)
if ~strncmpi(this(tI).Hostname, urlParts.Hostname, numel(this(tI).Hostname))
Error in opcua (line 46)
uaObj = opc.ua.Client(varargin{:});
In R2023a and newer:
Could not receive endpoint from URL <...>.
Check if hostname can be resolved.
采纳的回答
MathWorks Support Team
2024-9-13
This issue happens when hostname to IP conversion doesn't occur in the Windows OS. Try the following steps:
1. Navigate to the following path in your Windows Explorer: C:\Windows\System32\drivers\etc\hosts
2. Open the file "hosts".
3. At the bottom of the file "hosts" where there are no "#" symbols, type in the hostname & IP pair for your server. There should be a space between "hostname" and the IP address. It should look something like this:
12.34.56.789 hostname.domainname.com
This may help MATLAB locate your server.
4. You can then try calling 'opcua' like this:
client = opcua('12.34.56.789', 63500)
Replacing "12.34.56.789" with your server's IP address.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!