I have checked your code and problem, I can help you, for solving your errors in Matlab. I am using this software from past 4 years.
I have used this software rigorously for different project
where I have used computer vision, Simulink, pure coding, fuzzy toolbox etc.
So, if you give me the chance, I can definitely satisfy you with my work.