%%% The order of file names should be consistent. The first and second %%% files will be plotted against each other and the third and fourth files %%% will be plotted againast each other. Furthermore 1 and 3 should match %%% and 2 and 4 should match. For example in the below example 1 and 3 are %%% both V2 and 2 and 4 are both V5. These will need to match to ensure %%% that the same variable type is ploted on the same axes. %%% Also, you will need to be in the same directory as these files for %%% this script to run. %%% %%% To use this script, open the file with the matlab editor. Change the %%% file names to match your own (paying attention to the rules mentioned %%% above. Make sure you are in the same directory as the files and then %%% simply hit crtl+enter on windows and linux, or command+enter on OS X. %%% This will run the script and generate the figure for you. %%% %%% Example: %%% filenames = {'PPI_V2xAtn.mat' 'PPI_V5xAtn.mat' 'PPI_V2xNoAtn.mat' 'PPI_V5xNoAtn.mat'}; %%% %%% %%% Enjoy!, Aaron Schultz 03-16-2010, aschultz@nmr.mgh.harvard.edu %%% %%% filenames = {'PPI_V2xAtn.mat' 'PPI_V5xAtn.mat' 'PPI_V2xNoAtn.mat' 'PPI_V5xNoAtn.mat'}; for ii = 1:length(filenames); fn = filenames{ii}; ind = find(fn == '.'); name = fn(1:ind-1); load(fn); dat(:,ii) = PPI.ppi; ind = find(fn=='_'); filenames{ii}(ind) = '-'; end figure(1); clf; plot(dat(:,1), dat(:,2),'k.', 'markersize', 6); hold on; plot(dat(:,3), dat(:,4),'r.', 'markersize', 6); shg plot(dat(:,1), polyval(polyfit(dat(:,1), dat(:,2),1) , dat(:,1)),'k-', 'linewidth', 1.5); shg plot(dat(:,3), polyval(polyfit(dat(:,3), dat(:,4),1) , dat(:,3)),'r-', 'linewidth', 1.5); shg a = legend([filenames{1} ' vs. ' filenames{2}], [filenames{3} ' vs. ' filenames{4}]); set(a,'Fontsize', 14, 'location', 'NorthWest'); xlabel('Whatever Type Filename #1 is.', 'fontsize', 14); ylabel('Whatever Type Filename #2 is.', 'fontsize', 14); title('A title', 'fontsize', 16, 'fontname', 'Times');