function PSOBACKUPFILE(cast,iter,vst,maxium,g,best,G,G_best,G_vect,P,P_best,F,v,fr,walls,weight,delta_t,c,K,fi,evalute,bound,w,start)

% Nacteni adresare
addpath('../files/');
% Otevreni souboru
fid = fopen('files/backup.m', 'wt');

% Zapsani casti textu do souboru
fprintf(fid, ['%%Backup file was created at ',datestr(now),'\n']);
fprintf(fid, '%%-----------------------------------------------\n');
fprintf(fid, '%%PSO BACKUP FILE\n');
fprintf(fid, '%%-----------------------------------------------\n\n');
fprintf(fid, '%%Ulozeni parametru je nasledovne!\n');
fprintf(fid, ['pocet_iteraci=[',num2str(iter),'];\n']);
fprintf(fid, ['pocet_castic=[',num2str(cast),'];\n']);
fprintf(fid, ['pocet_vstupu=[',num2str(vst),'];\n']);
fprintf(fid, ['maximum=[',num2str(maxium),'];\n']);
fprintf(fid, 'F = [\n');
for i=1:length(F)
    fprintf(fid, ['',num2str(F(i,:)),';\n']);
end
fprintf(fid, '];\n');

fprintf(fid, 'P = [\n');
[m,n]=size(P);

for i=1:m
    fprintf(fid, ['',num2str(P(i,:)),';\n']);
end
fprintf(fid, '];\n');

fprintf(fid, 'P_best = [\n');
[m,n]=size(P_best);

for i=1:m
    fprintf(fid, ['',num2str(P_best(i,:)),';\n']);
end
fprintf(fid, '];\n');

fprintf(fid, 'v = [\n');
for i=1:length(v)
    fprintf(fid, ['',num2str(v(i,:)),';\n']);
end
fprintf(fid, '];\n');
fprintf(fid, ['G = [',num2str(G),'];\n']);
fprintf(fid, 'G_best = [\n');
[m,n]=size(G_best);
for i=1:m
    fprintf(fid, ['',num2str(G_best(i,:)),';\n']);
end
fprintf(fid, '];\n');
fprintf(fid, ['G_vect = [',num2str(G_vect),'];\n']);
fprintf(fid, ['best=[',num2str(best),'];\n']);
fprintf(fid, ['fr1=[',num2str(fr(1)),'];\n']);
fprintf(fid, ['fr2=[',num2str(fr(2)),'];\n']);
fprintf(fid, ['delta_t=[',num2str(delta_t),'];\n']);
fprintf(fid, ['c1=[',num2str(c(1)),'];\n']);
fprintf(fid, ['c2=[',num2str(c(2)),'];\n']);
fprintf(fid, ['K=[',num2str(K),'];\n']);
fprintf(fid, ['fi_1=[',num2str(fi(1)),'];\n']);
fprintf(fid, ['fi_2=[',num2str(fi(1)),'];\n']);
fprintf(fid, 'evalute = [\n');
for i=1:length(evalute)
    fprintf(fid, ['',num2str(evalute(i,:)),';\n']);
end
fprintf(fid, '];\n');
fprintf(fid, 'bound = [\n');
for i=1:length(bound)
    fprintf(fid, ['',num2str(bound(i,:)),';\n']);
end
fprintf(fid, '];\n');
fprintf(fid, ['m=[',num2str(m),'];\n']);
fprintf(fid, ['g=[',num2str(g),'];\n']);
fprintf(fid, ['w =[',num2str(w),'];\n']);
fprintf(fid, ['walls=[''',walls,'''];\n']);
fprintf(fid, ['weight=[''',weight,'''];\n']);
fprintf(fid, ['start =[',num2str(start),'];\n']);
fprintf(fid, '%%-----------------------------------------------\n');
fclose(fid);
end