MATLAB: For loop error: Subscript indices must either be real positive integers or logicals

controlerrorfor loopMATLABsimulink

I am executing a for loop but it gives following error at time 0.6:
T_o=[0;0;0];
T_d=[0;0;0];
T_l=[0;0;0];
out_n=zeros([],3);
for t=0:0.1:10
T_o = [0.05*(10-t);0.04*(10-t);0.03*(10-t)];
T_e=T_d-T_o;
T_e=[t*10 T_e'];
a = sim('PD_control','SimulationMode','normal');
out = a.get('T_u');
out_n(t*10+1,:) = out(2,:)
end
The Simulink file called by this code is attached here.

Best Answer

T_o=[0;0;0];
T_d=[0;0;0];
T_l=[0;0;0];
out_n=zeros([],3);
tt=0:0.1:10 ;
for i = 1:length(tt)
t = tt(i) ;
T_o = [0.05*(10-t);0.04*(10-t);0.03*(10-t)];
T_e=T_d-T_o;
T_e=[t*10 T_e'];
a = sim('PD_control','SimulationMode','normal');
out = a.get('T_u');
out_n(i,:) = out(2,:)
end