function make_movie(ninst,clims,AllInst,nvars,species,iterations)

%Making the Movie
num = 1;
time = ninst;
SDiff = 1;
num = 1;
nS = nvars;

while nS ~= nvars+1
    disp('Choose species to create movie: ');
    for ind = 1:nvars
        disp([int2str(ind) '. ' species{ind} ]);
    end
    disp([int2str(nvars+1) '. Back']);
    nS = input('select the corresponding number: ');

    if nS ~= nvars+1
        clear F;
        figure
        name = input('input a name to create an AVI file: ','s');
        num = 1;
        for SDiff = 1:iterations
            for time = 1:ninst

                imagesc(AllInst{1}{nS,time,SDiff}(:,:),clims{nS});
                colormap('default')
                colorbar();
                title(sprintf('Species %s Iteration %d time(min) %d', species{nS}, SDiff,num));
                xlabel('plate columns');
                ylabel('plate rows');
                F(num) = getframe(gcf);
                num = num + 1;
            end
        end
        movie2avi(F,[name '.avi'],'compression','none');
        close;
    end
end


