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

4 Ansichten (letzte 30 Tage)
Guido
Guido am 5 Jul. 2015
Beantwortet: Guido am 12 Jul. 2015
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?

Antworten (2)

Image Analyst
Image Analyst am 5 Jul. 2015
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 am 12 Jul. 2015
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

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by