Azzera filtri
Azzera filtri

Disabling the Keyboard with the Matlab command

5 visualizzazioni (ultimi 30 giorni)
Hello everyone I have two following question:
1- I want to give someone my code (in the protected file) so I used the matlab command of "pcode". I also don't want that the user be able to stop the code by pressing the "Ctrl+C", which means I want to run the code completely. What do I have to do?
2- Is there any command line that help me to not give the error details (just mention the line number on which the error occured) if either the user stop the code or there is a problem?
Any help is appreciated Thanks in advance

Risposta accettata

Guillaume il 8 Nov 2014
You can catch errors and issue your own error message.
There is a also the oncleanup callback that can be executed whenever your function ends, regardless of the reason.
There is no way to prevent the user from stopping your code and there shouldn't be.
I would strongly advise you to rethink your strategy though. The less user friendly your code is, the less inclined the user will be to use it. If you catch error messages it should be to better explain what went wrong, not to hide it.
I also worry that a) you want to prevent errors being display, indicating that your code may not always work as it should and b) prevent the user to stop your code if it goes wrong. What if your code goes into an infinite loop?
You've encrypted your code, so the user cannot look at the source code anyway. You should leave at that. Or if you do catch errors / invoke cleanup functions, it should be for the right reasons: make your code more robust.
  1 Commento
Mahdiyar il 8 Nov 2014
thank you for your informative response. Actually the only resson that I do not want to user be able to stop the code is that it is so important and confidential. So I thought that the user may stop the code and understand the command of some important line because when you stop the code it gives you and error message and explain the command line. It also may happen if the commands are not adapted for the OS running on the user computer.

Accedi per commentare.

Più risposte (0)


Scopri di più su Desktop in Help Center e File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by