

echo off
clear
pack
clg
clc
havefun='Enough of this already, go get a beer!';
hitkey='Hit any key to continue';
cont = 'y';
yn=input('Do you want to print the plots (y or n)?  ', 's');
if (yn == 'Y')
  (yn == 'y')
end 
if (yn == 'y')
  pname=input('What is the name of your printer? ','s');
  clg
  clc
  while cont == 'y'
    clear sigma_c sigma_se sigma_t optical_A optical_E E A
    clc
    disp('Enter the system parameters')
   

!optical_1
clc
disp('Working please wait .......')
load optical_A.dat
load optical_E.dat
constant_E=exist('optical_A');
constant_A=exist('optical_E');
count = 1;
if constant_E == 1

	E = optical_A(1,1);
	[num_rows,num_col]=size(optical_A);
	for loop1 = 2:num_rows
		test1 =optical_A(loop1,2)==0;
		test2 =optical_A(loop1,3)==0;
		test3 =optical_A(loop1,4)==0;
		test4 =count>1;
		stest = test1+test2+test3+test4;
		if stest == 4;
			A(count) = optical_A(loop1,1);
			sigma_c(count-1) = optical_A(loop1-1,3);
			sigma_t(count-1) = optical_A(loop1-1,5);
			sigma_se(count-1) = optical_A(loop1-1,6);
			count = count +1;
		end
		test4 = count==1;
		stest = test1+test2+test3+test4;
		if stest == 4;
			A(count) = optical_A(loop1,1);
			count = count +1;
		end
		if loop1 == num_rows
			sigma_c(count-1) = optical_A(loop1,3);
			sigma_t(count-1) = optical_A(loop1,5);
			sigma_se(count-1) = optical_A(loop1,6);
		end
end
	plot(A,sigma_c),xlabel('Atomic Number'),ylabel('sigma C'),
	title(['Sigma C  v. Atomic Number  Energy = ',num2str(E),' MeV'])
    print(pname)
    disp(hitkey)
    pause
    clg

	plot(A,sigma_t),xlabel('Atomic Number'),ylabel('sigma T'),
	title(['Sigma T  v. Atomic Number  Energy = ',num2str(E),' MeV'])
    print(pname)
    disp(hitkey)
    pause
    clg

	plot(A,sigma_se),xlabel('Atomic Number'),ylabel('sigma SE'),
	title(['Sigma SE  v. Atomic Number  Energy = ',num2str(E),' MeV'])
    print(pname)
    disp(hitkey)
    pause
    clg
end
		






if constant_A == 1
	A = optical_E(1,1);
	[num_rows,num_col]=size(optical_E);
	for loop1 = 2:num_rows
		test1 =optical_E(loop1,2)==0;
		test2 =optical_E(loop1,3)==0;
		test3 =optical_E(loop1,4)==0;
		test4 =count>1;
		stest = test1+test2+test3+test4;
		if stest == 4;
			E(count) = optical_E(loop1,1);
			sigma_c(count-1) = optical_E(loop1-1,3);
			sigma_t(count-1) = optical_E(loop1-1,5);
			sigma_se(count-1) = optical_E(loop1-1,6);
			count = count +1;
		end
		test4 = count==1;
		stest = test1+test2+test3+test4;
		if stest == 4;
			E(count) = optical_E(loop1,1);
			count = count +1;
		end
		if loop1 == num_rows
			sigma_c(count-1) = optical_E(loop1,3);
			sigma_t(count-1) = optical_E(loop1,5);
			sigma_se(count-1) = optical_E(loop1,6);
		end
	end
	plot(E,sigma_c),xlabel('Energy  (MeV)'),ylabel('sigma C'),
	title(['Sigma C  v.  Energy   Atomic Number= ',num2str(A)])
    print(pname)
    disp(hitkey)
    pause
    clg

	plot(E,sigma_t),xlabel('Energy  (MeV)'),ylabel('sigma T'),
	title(['Sigma T  v. Energy   Atomic Number= ',num2str(A),])
    print(pname)
    disp(hitkey)
    pause
    clg

	plot(E,sigma_se),xlabel('Energy  (MeV)'),ylabel('sigma SE'),
	title(['Sigma SE  v. Energy   Atomic Number = ',num2str(A)])
    print(pname)
    disp(hitkey)
    pause
    clg
end
    clc
    cont=input('Do you want to continue (y or n)?  ', 's');
  end
else
  while cont == 'y'
    clear sigma_c sigma_se sigma_t optical_A optical_E E A
    clc
    disp('Enter the system parameters')
    
!optical_1
clc
disp('Working please wait .......')
load optical_A.dat
load optical_E.dat
constant_E=exist('optical_A');
constant_A=exist('optical_E');
count = 1;
if constant_E == 1

	E = optical_A(1,1);
	[num_rows,num_col]=size(optical_A);
	for loop1 = 2:num_rows
		test1 =optical_A(loop1,2)==0;
		test2 =optical_A(loop1,3)==0;
		test3 =optical_A(loop1,4)==0;
		test4 =count>1;
		stest = test1+test2+test3+test4;
		if stest == 4;
			A(count) = optical_A(loop1,1);
			sigma_c(count-1) = optical_A(loop1-1,3);
			sigma_t(count-1) = optical_A(loop1-1,5);
			sigma_se(count-1) = optical_A(loop1-1,6);
			count = count +1;
		end
		test4 = count==1;
		stest = test1+test2+test3+test4;
		if stest == 4;
			A(count) = optical_A(loop1,1);
			count = count +1;
		end
		if loop1 == num_rows
			sigma_c(count-1) = optical_A(loop1,3);
			sigma_t(count-1) = optical_A(loop1,5);
			sigma_se(count-1) = optical_A(loop1,6);
		end
end
	plot(A,sigma_c),xlabel('Atomic Number'),ylabel('sigma C'),
	title(['Sigma C  v. Atomic Number  Energy = ',num2str(E),' MeV'])
disp(hitkey);pause

	plot(A,sigma_t),xlabel('Atomic Number'),ylabel('sigma T'),
	title(['Sigma T  v. Atomic Number  Energy = ',num2str(E),' MeV'])
disp(hitkey);pause

	plot(A,sigma_se),xlabel('Atomic Number'),ylabel('sigma SE'),
	title(['Sigma SE  v. Atomic Number  Energy = ',num2str(E),' MeV'])
disp(hitkey);pause
end
		






if constant_A == 1
	A = optical_E(1,1);
	[num_rows,num_col]=size(optical_E);
	for loop1 = 2:num_rows
		test1 =optical_E(loop1,2)==0;
		test2 =optical_E(loop1,3)==0;
		test3 =optical_E(loop1,4)==0;
		test4 =count>1;
		stest = test1+test2+test3+test4;
		if stest == 4;
			E(count) = optical_E(loop1,1);
			sigma_c(count-1) = optical_E(loop1-1,3);
			sigma_t(count-1) = optical_E(loop1-1,5);
			sigma_se(count-1) = optical_E(loop1-1,6);
			count = count +1;
		end
		test4 = count==1;
		stest = test1+test2+test3+test4;
		if stest == 4;
			E(count) = optical_E(loop1,1);
			count = count +1;
		end
		if loop1 == num_rows
			sigma_c(count-1) = optical_E(loop1,3);
			sigma_t(count-1) = optical_E(loop1,5);
			sigma_se(count-1) = optical_E(loop1,6);
		end
	end
	plot(E,sigma_c),xlabel('Energy  (MeV)'),ylabel('sigma C'),
	title(['Sigma C  v.  Energy   Atomic Number= ',num2str(A)])
disp(hitkey);pause

	plot(E,sigma_t),xlabel('Energy  (MeV)'),ylabel('sigma T'),
	title(['Sigma T  v. Energy   Atomic Number= ',num2str(A),])
disp(hitkey);pause

	plot(E,sigma_se),xlabel('Energy  (MeV)'),ylabel('sigma SE'),
	title(['Sigma SE  v. Energy   Atomic Number = ',num2str(A)])
disp(hitkey);pause
end
    clg
    clc
    cont=input('Do you want to continue (y or n)?  ', 's');
  end
end