file = 'comp0.txt'; f = fopen(file); miters = 100; x = 1:miters; Syn = zeros(miters,1); for i = 1 : miters line = fgets(f); line= strsplit(line); Syn(i,1) = str2num(line{3}); end Full = zeros(miters,1); for i = 1 : miters line = fgets(f); line= strsplit(line); Full(i,1) = str2num(line{3}); end Random = zeros(miters,1); for i = 1 : miters line = fgets(f); line= strsplit(line); Random(i,1) = str2num(line{3}); end fclose(f); width = 3; height = 3; alw = 2.75; fsz = 24; lw = 2.5; msz = 8; semilogy(x, Syn, x, Random, x, Full, 'LineWidth', 4.5, 'MarkerSize', msz); xlabel('Iteration number'); ylabel('Cost Function Value'); xlim([1, miters]) legend('8 Synergies', '8 Random Synergies', 'Full') legend boxoff; box off; ylim([0 5]) %set(h1,'Location','BestOutside'); set(gca, 'FontSize', fsz, 'LineWidth', lw) file2 = strrep(file, '.txt', ''); saveas(gcf, strcat('MLRandomSynergies','.fig')); saveas(gcf, strcat('MLRandomSynergies','.eps'), 'epsc'); saveas(gcf, strcat('MLRandomSynergies','.pdf'));