Matlab executable throws error in opc.ua.Client
Ältere Kommentare anzeigen
I used MATLAB Compiler (2022b) to deploy a small algorithm that grabs data over the matlab opc-ua interface. So i used the icomm\opc...On the computer where i have all the toolboxes the executeable can be run without throwing an error. But when i run it on another computer, where i installed the 2022b runtime i get the following error-stack:
file: C:\Programm Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\icomm\opc\opc\+opc\+ua\Client.m
name: Client.Client
line: 386
I tried it on severals pc´s, only when there is also a matlab license of the toolbox containing the opc-ua it works.
Can someone please give me a hint how i can solve the problem.
4 Kommentare
Steven Lord
am 6 Sep. 2024
From the fact that the error stack mentions the MCR, I'm guessing you're not using MATLAB Coder to generate C or C++ code from your application but that you're using MATLAB Compiler to generate a standalone application. Can you confirm that my guess is correct?
Something else that supports my guess is the fact that the documentation page for the opcua function does not list "C/C++ Code Generation" as an extended capability, suggesting to me that it is not supported for use with MATLAB Coder.
If I'm correct, how are you creating the object or getting it into your application? Are you perhaps calling load to load a MAT-file containing a previously created object into your application?
Andreas
am 7 Sep. 2024
Steven Lord
am 8 Sep. 2024
Can you show the code for the method in which you create the opc-ua connection?
Andreas
am 8 Sep. 2024
Antworten (2)
Image Analyst
am 8 Sep. 2024
Bearbeitet: Image Analyst
am 8 Sep. 2024
0 Stimmen
Try including that file explicitly in your compilation, something like
mcc yourapp.m -a " C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\icomm\opc\opc\+opc\+ua\Client.m"
but actually you must change the path to what it is on your computer, not the target computer, so it will find it.
4 Kommentare
Andreas
am 8 Sep. 2024
Image Analyst
am 9 Sep. 2024
Search the whole hard drive for Client.m. Also search the hidden CTF folder. For example C:\Users\MyUserName\AppData\Local\Temp\MyUserName\mcrCache7.16\MyApp\.
Andreas
am 9 Sep. 2024
Image Analyst
am 9 Sep. 2024
I don't know what that thing is. It's not something that shows up as an applet inside MATLAB is it? Does it have it's own GUI? Because I think applets on the Apps tab of the tool ribbon cannot be included in a standalone executable. Otherwise I'd try to recompile with the latest R2024a and try that. If that doesn't work, call tech support.
Stefanie Schwarz
am 16 Sep. 2024
0 Stimmen
The error in line 386 of "opc.ua.Client" indicates that there might be an issue with resolving the OPA UA endpoint hostname. See the following MATLAB Answer for more info:
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!