Ok, with the script provided, the problem is obvious. The script is referring to signals u1, u2,u3, and y1,y2,y3 in the model, but they are not defined there. All you need to do is name those signals in the model, as is done in the attached file.
Change your script to refer to this mdl file in lines 19 and 22.
I ran your script to line 49 and ran the model with the tuned gains to confirm a nice, stable design.
P.S. If you have access to R2014a or R2014b, you can now do this workflow from a nice app (GUI) called Control System Tuner - makes it easier to setup the problem and not screw up the code.