Disabling the Keyboard with the Matlab command
2 views (last 30 days)
Show older comments
Commented: Mahdiyar on 8 Nov 2014
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
Guillaume on 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.
More Answers (0)
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!