Disabling the Keyboard with the Matlab command

조회 수: 6 (최근 30일)
Mahdiyar
Mahdiyar 2014년 11월 8일
댓글: Mahdiyar 2014년 11월 8일
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
Guillaume 2014년 11월 8일
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
Mahdiyar
Mahdiyar 2014년 11월 8일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by