I solved this with an external program and the code result this:
for h=1:t .
.
.
G=imagesc(cancha);
pause(0.001);
hold on
Image = getframe;
P = frame2im(Image);
number = num2str(h);
extension = '.bmp';
filename = [number,extension];
imwrite(P,eval('filename'), 'bmp');
hold off
end (of the "for h")
With this you made "t" images "bmp", and after with this program: http://uwcem.ece.wisc.edu/downloadable/GaLE10.exe
Where you select the images bmp and press preview and you obtain a GIF. This probably wouldn´t be best way to do the GIF, but it's the only way I know. If someone knows another please tell me!
