필터 지우기
필터 지우기

Cannot execute 'winqueryreg()' in executable GUI on target computer

조회 수: 2 (최근 30일)
Guido
Guido 2015년 7월 5일
답변: Guido 2015년 7월 12일
Hi guys,
I created a standalone GUI (executable). In a function within the code, it should scan and list all COM ports. This is done with the following line:
devices = winqueryreg('name', 'HKEY_LOCAL_MACHINE', 'HARDWARE\DEVICEMAP\SERIALCOMM');
This works fine on the PC on which I created and compiled the exe file.
On target PC, the exe-file starts fine but when the line is executed, it gives an error sound and stops working.
It was compiled on a PC with MCR 8.5 64 bit which was also present on target PC.
Two questions:
Can I somehow find out what the error is that occors on target PC when executing the line?
Why could there be an error on target PC and not on PC on which it was compiled?

답변 (2개)

Image Analyst
Image Analyst 2015년 7월 5일
It doesn't work on mine even in the MATLAB development environment. What is 'name' doing in there? 'HKEY_LOCAL_MACHINE' should be your first argument. This is an example of how I use it:
registryKeyValue = winqueryreg('HKEY_LOCAL_MACHINE', 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'PROCESSOR_ARCHITECTURE');
By the way, on my computer this will fail:
devices = winqueryreg('HKEY_LOCAL_MACHINE', 'HARDWARE\DEVICEMAP\SERIALCOMM');
because I don't have the SERIALCOMM key under DEVICEMAP. I suggest you put that call in a try/catch block in case the computer does not have that key (like mine).

Guido
Guido 2015년 7월 12일
Thanks Image Analyst for the tip.
I just took this querry fom a page and it seemed to work flawless listing the COM-ports. However, after compiling it, it doesn't work anymore.
Now I tried to use instrfindall , but that also gives an error after compiling. Really frustrating. I'll post a new question dedicated to this problem.
So the conclusion is: I stil haven't found a way to list the comports in a Matlab executable.
Regards,
Guido

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by