Perhaps convert your code to p-code to discourage modifying your codes. It is NOT a full protection for modifying your codes though.
Complete protection against modification is tricky. This would require compiling your code via something likemcc, and if you really want, adding some security checks against modification / reverse engineering (that's above my skill set). But then, its not really usable via Matlab sessions.