function varargout = sliderSpreadSheet9LGfont(varargin) 
% SLIDERSPREADSHEET9LGFONT M-file for sliderSpreadSheet9LGfont.fig
%      SLIDERSPREADSHEET9LGFONT, by itself, creates a new SLIDERSPREADSHEET9LGFONT or raises the existing
%      singleton*.
%
%      H = SLIDERSPREADSHEET9LGFONT returns the handle to a new SLIDERSPREADSHEET9LGFONT or the handle to
%      the existing singleton*.
%
%      SLIDERSPREADSHEET9LGFONT('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SLIDERSPREADSHEET9LGFONT.M with the given input arguments.
%
%      SLIDERSPREADSHEET9LGFONT('Property','Value',...) creates a new SLIDERSPREADSHEET9LGFONT or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before sliderSpreadSheet9LGfont_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to sliderSpreadSheet9LGfont_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help sliderSpreadSheet9LGfont

% Last Modified by GUIDE v2.5 27-Sep-2005 10:20:35

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @sliderSpreadSheet9LGfont_OpeningFcn, ...
                   'gui_OutputFcn',  @sliderSpreadSheet9LGfont_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before sliderSpreadSheet9LGfont is made visible.
function sliderSpreadSheet9LGfont_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to sliderSpreadSheet9LGfont (see VARARGIN)

% Choose default command line output for sliderSpreadSheet9LGfont
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes sliderSpreadSheet9LGfont wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = sliderSpreadSheet9LGfont_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

%----------------------------------------------------------------------
%--------------Above is good-------------------------------------------
%----------------------------------------------------------------------

%----------------------------------------------------------------------
%---Struct A data manipulation

% --- Executes on selection change in popupmenuStructA.
function popupmenuStructA_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenuStructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenuStructA contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenuStructA


% --- Executes during object creation, after setting all properties.
function popupmenuStructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenuStructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in popupmenuDoseA.
function popupmenuDoseA_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenuDoseA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenuDoseA contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenuDoseA


% --- Executes during object creation, after setting all properties.
function popupmenuDoseA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenuDoseA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbuttonCalculateStructA.
function pushbuttonCalculateStructA_Callback(hObject, eventdata, handles, varargin)
% hObject    handle to pushbuttonCalculateStructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%original
val = get(handles.popupmenuStructA,'Value');
dose= str2double(get(handles.doseStructA, 'String'))/100;
ranking=[1:5];
%new

switch val %the structure
    %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    case 1 %for structure 1
        f1=get(handles.file1Struct1_label,'String');
        f2= get(handles.file2Struct1_label, 'String');
        f3= get(handles.file3Struct1_label, 'String');
        f4= get(handles.file4Struct1_label, 'String');
        f5= get(handles.file5Struct1_label, 'String');
    case 2 % for structure 2
        f1=get(handles.file1Struct2_label,'String');
        f2= get(handles.file2Struct2_label, 'String');
        f3= get(handles.file3Struct2_label, 'String');
        f4= get(handles.file4Struct2_label, 'String');
        f5= get(handles.file5Struct2_label, 'String');
    case 3 % for structure 3
        f1=get(handles.file1Struct3_label,'String');
        f2= get(handles.file2Struct3_label, 'String');
        f3= get(handles.file3Struct3_label, 'String');
        f4= get(handles.file4Struct3_label, 'String');
        f5= get(handles.file5Struct3_label, 'String');
end;

x=0;y=0;
counter=1;
if not(isequal(size(f1),[1,0])) % check that there is a file to load
    file1= load(f1); %load bl6;     %  read data into the bl6 matrix
    x = file1(:,1);     %  copy first column of bl6 into x
    y = file1(:,2);     %  and second column into y
    while file1(counter, 2)>dose
        counter=counter+1;
    end
end
%starting at the largest value in the dose column, work down until get past
%the dose requested.

x2=0;y2=0;
counter2=1;
if not(isequal(size(f2),[1 0]))
    file2=load(f2);     %  read data into the bl7 matrix
    x2 = file2(:,1);     %  copy first column of bl7 into x
    y2 = file2(:,2);     %  and second column into y
    while file2(counter2, 2)>dose
       counter2=counter2+1;
    end
end

x3=0;y3=0;
counter3=1;
if not(isequal(size(f3),[1 0]))
    file3=load(f3);     %  read data into the bl7 matrix
    x3 = file3(:,1);     %  copy first column of bl7 into x
    y3 = file3(:,2);     %  and second column into y
    while file3(counter3, 2)>dose
        counter3=counter3+1;
    end
end

x4=0;y4=0;
counter4=1;
if not(isequal(size(f4),[1 0]))
    file4=load(f4);     %  read data into the bl7 matrix
    x4 = file4(:,1);     %  copy first column of bl7 into x
    y4 = file4(:,2);     %  and second column into y
    while file4(counter4, 2)>dose
        counter4=counter4+1;
    end
end

x5=0;y5=0;
counter5=1;
if not(isequal(size(f5),[1 0]))
    file5=load(f5);     %  read data into the bl7 matrix
    x5 = file5(:,1);     %  copy first column of bl7 into x
    y5 = file5(:,2);     %  and second column into y
    while file5(counter5, 2)>dose
        counter5=counter5+1;
    end
end

% code to display the appropriate values
set(handles.percent1StructA,'String', file1(counter,1)/100);
set(handles.percent2StructA,'String', file2(counter2,1)/100);
set(handles.percent3StructA,'String', file3(counter3,1)/100);
set(handles.percent4StructA,'String', file4(counter4,1)/100);
set(handles.percent5StructA,'String', file5(counter5,1)/100);
set(handles.plan1StructA, 'String', ranking(1));
set(handles.plan2StructA, 'String', ranking(2));
set(handles.plan3StructA, 'String', ranking(3));
set(handles.plan4StructA, 'String', ranking(4));
set(handles.plan5StructA, 'String', ranking(5));


% --- Executes on selection change in popupSortA.
function popupSortA_Callback(hObject, eventdata, handles, varargin)
% hObject    handle to popupSortA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupSortA contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupSortA
percent=[str2double(get(handles.percent1StructA, 'String')) 1
    str2double(get(handles.percent2StructA, 'String')) 2
    str2double(get(handles.percent3StructA, 'String')) 3
    str2double(get(handles.percent4StructA, 'String')) 4
    str2double(get(handles.percent5StructA, 'String')) 5]
[B,index]= sortrows(percent, 1) %sortedPercent= sort(percent, 1)
% reprint the now sorted rows and columns
set(handles.plan1StructA, 'String', index(1));
set(handles.plan2StructA, 'String', index(2));
set(handles.plan3StructA, 'String', index(3));
set(handles.plan4StructA, 'String', index(4));
set(handles.plan5StructA, 'String', index(5));
set(handles.percent1StructA,'String', B(1,1));
set(handles.percent2StructA,'String', B(2,1));
set(handles.percent3StructA,'String', B(3,1));
set(handles.percent4StructA,'String', B(4,1));
set(handles.percent5StructA,'String', B(5,1));

val = get(handles.popupSortA,'Value');
if (val==2)
   
  set(handles.plan1StructB, 'String', index(1));
  set(handles.plan2StructB, 'String', index(2));
  set(handles.plan3StructB, 'String', index(3));
  set(handles.plan4StructB, 'String', index(4));
  set(handles.plan5StructB, 'String', index(5));
  set(handles.plan1StructC, 'String', index(1));
  set(handles.plan2StructC, 'String', index(2));
  set(handles.plan3StructC, 'String', index(3));
  set(handles.plan4StructC, 'String', index(4));
  set(handles.plan5StructC, 'String', index(5));
  
  %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  % handle second structure of interest
  choice = get(handles.popupmenuStructB,'Value');
  dose= str2double(get(handles.doseStructB, 'String'))/100;
  switch choice
      case 1 %for structure 1
          fprintf('selected structure 1 for column B');
            f1=get(handles.file1Struct1_label,'String');
            f2= get(handles.file2Struct1_label, 'String');
            f3= get(handles.file3Struct1_label, 'String');
            f4= get(handles.file4Struct1_label, 'String');
            f5= get(handles.file5Struct1_label, 'String');
        case 2 % for structure 2
            fprintf('selected structure 2 for column B');
            f1=get(handles.file1Struct2_label,'String');
            f2= get(handles.file2Struct2_label, 'String');
            f3= get(handles.file3Struct2_label, 'String');
            f4= get(handles.file4Struct2_label, 'String');
            f5= get(handles.file5Struct2_label, 'String');
        case 3 % for structure 3
            fprintf('selected structure 3 for column B');
            f1=get(handles.file1Struct3_label,'String');
            f2= get(handles.file2Struct3_label, 'String');
            f3= get(handles.file3Struct3_label, 'String');
            f4= get(handles.file4Struct3_label, 'String');
            f5= get(handles.file5Struct3_label, 'String');
    end;

    x=0;y=0;
    counter=1;
    if not(isequal(size(f1),[1,0])) % check that there is a file to load
        file1= load(f1); %load bl6;     %  read data into the bl6 matrix
        x = file1(:,1);     %  copy first column of bl6 into x
        y = file1(:,2);     %  and second column into y
        while file1(counter, 2)>dose
            counter=counter+1;
        end
    end
    %starting at the largest value in the dose column, work down until get past
    %the dose requested.

    x2=0;y2=0;
    counter2=1;
    if not(isequal(size(f2),[1 0]))
        file2=load(f2);     %  read data into the bl7 matrix
        x2 = file2(:,1);     %  copy first column of bl7 into x
        y2 = file2(:,2);     %  and second column into y
        while file2(counter2, 2)>dose
           counter2=counter2+1;
        end
    end

    x3=0;y3=0;
    counter3=1;
    if not(isequal(size(f3),[1 0]))
        file3=load(f3);     %  read data into the bl7 matrix
        x3 = file3(:,1);     %  copy first column of bl7 into x
        y3 = file3(:,2);     %  and second column into y
        while file3(counter3, 2)>dose
            counter3=counter3+1;
        end
    end

    x4=0;y4=0;
    counter4=1;
    if not(isequal(size(f4),[1 0]))
        file4=load(f4);     %  read data into the bl7 matrix
        x4 = file4(:,1);     %  copy first column of bl7 into x
        y4 = file4(:,2);     %  and second column into y
        while file4(counter4, 2)>dose
            counter4=counter4+1;
        end
    end

    x5=0;y5=0;
    counter5=1;
    if not(isequal(size(f5),[1 0]))
        file5=load(f5);     %  read data into the bl7 matrix
        x5 = file5(:,1);     %  copy first column of bl7 into x
        y5 = file5(:,2);     %  and second column into y
        while file5(counter5, 2)>dose
            counter5=counter5+1;
        end
    end

%     % code to display the appropriate values
    for n=1:5
        if index(n)== 1
            if n==1
                set(handles.percent1StructB,'String', file1(counter,1)/100);
            elseif n==2
                set(handles.percent2StructB,'String', file1(counter,1)/100);
            elseif n==3
                set(handles.percent3StructB,'String', file1(counter,1)/100);
            elseif n==4
                set(handles.percent4StructB,'String', file1(counter,1)/100);
            else 
                set(handles.percent5StructB,'String', file1(counter,1)/100);
            end
        elseif index(n)==2
            if n==1
                set(handles.percent1StructB,'String', file2(counter2,1)/100);
            elseif n==2
                set(handles.percent2StructB,'String', file2(counter2,1)/100);
            elseif n==3
                set(handles.percent3StructB,'String', file2(counter2,1)/100);
            elseif n==4
                set(handles.percent4StructB,'String', file2(counter2,1)/100);
            else 
                set(handles.percent5StructB,'String', file2(counter2,1)/100);
            end    
        elseif index(n)== 3
            if n==1
                set(handles.percent1StructB,'String', file3(counter3,1)/100);
            elseif n==2
                set(handles.percent2StructB,'String', file3(counter3,1)/100);
            elseif n==3
                set(handles.percent3StructB,'String', file3(counter3,1)/100);
            elseif n==4
                set(handles.percent4StructB,'String', file3(counter3,1)/100);
            else 
                set(handles.percent5StructB,'String', file3(counter3,1)/100);
            end
        elseif index(n)==4
            if n==1
                set(handles.percent1StructB,'String', file4(counter4,1)/100);
            elseif n==2
                set(handles.percent2StructB,'String', file4(counter4,1)/100);
            elseif n==3
                set(handles.percent3StructB,'String', file4(counter4,1)/100);
            elseif n==4
                set(handles.percent4StructB,'String', file4(counter4,1)/100);
            else 
                set(handles.percent5StructB,'String', file4(counter4,1)/100);
            end
        else
            if n==1
                set(handles.percent1StructB,'String', file5(counter5,1)/100);
            elseif n==2
                set(handles.percent2StructB,'String', file5(counter5,1)/100);
            elseif n==3
                set(handles.percent3StructB,'String', file5(counter5,1)/100);
            elseif n==4
                set(handles.percent4StructB,'String', file5(counter5,1)/100);
            else 
                set(handles.percent5StructB,'String', file5(counter5,1)/100);
            end
        end
    end
%    

  %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  % handle second structure of interest
  choice = get(handles.popupmenuStructC,'Value');
  dose= str2double(get(handles.doseStructC, 'String'))/100;
  switch choice
      case 1 %for structure 1
          fprintf('selected structure 1 for column B');
            f1=get(handles.file1Struct1_label,'String');
            f2= get(handles.file2Struct1_label, 'String');
            f3= get(handles.file3Struct1_label, 'String');
            f4= get(handles.file4Struct1_label, 'String');
            f5= get(handles.file5Struct1_label, 'String');
        case 2 % for structure 2
            fprintf('selected structure 2 for column B');
            f1=get(handles.file1Struct2_label,'String');
            f2= get(handles.file2Struct2_label, 'String');
            f3= get(handles.file3Struct2_label, 'String');
            f4= get(handles.file4Struct2_label, 'String');
            f5= get(handles.file5Struct2_label, 'String');
        case 3 % for structure 3
            fprintf('selected structure 3 for column B');
            f1=get(handles.file1Struct3_label,'String');
            f2= get(handles.file2Struct3_label, 'String');
            f3= get(handles.file3Struct3_label, 'String');
            f4= get(handles.file4Struct3_label, 'String');
            f5= get(handles.file5Struct3_label, 'String');
    end;

    x=0;y=0;
    counter=1;
    if not(isequal(size(f1),[1,0])) % check that there is a file to load
        file1= load(f1); %load bl6;     %  read data into the bl6 matrix
        x = file1(:,1);     %  copy first column of bl6 into x
        y = file1(:,2);     %  and second column into y
        while file1(counter, 2)>dose
            counter=counter+1;
        end
    end
    %starting at the largest value in the dose column, work down until get past
    %the dose requested.

    x2=0;y2=0;
    counter2=1;
    if not(isequal(size(f2),[1 0]))
        file2=load(f2);     %  read data into the bl7 matrix
        x2 = file2(:,1);     %  copy first column of bl7 into x
        y2 = file2(:,2);     %  and second column into y
        while file2(counter2, 2)>dose
           counter2=counter2+1;
        end
    end

    x3=0;y3=0;
    counter3=1;
    if not(isequal(size(f3),[1 0]))
        file3=load(f3);     %  read data into the bl7 matrix
        x3 = file3(:,1);     %  copy first column of bl7 into x
        y3 = file3(:,2);     %  and second column into y
        while file3(counter3, 2)>dose
            counter3=counter3+1;
        end
    end

    x4=0;y4=0;
    counter4=1;
    if not(isequal(size(f4),[1 0]))
        file4=load(f4);     %  read data into the bl7 matrix
        x4 = file4(:,1);     %  copy first column of bl7 into x
        y4 = file4(:,2);     %  and second column into y
        while file4(counter4, 2)>dose
            counter4=counter4+1;
        end
    end

    x5=0;y5=0;
    counter5=1;
    if not(isequal(size(f5),[1 0]))
        file5=load(f5);     %  read data into the bl7 matrix
        x5 = file5(:,1);     %  copy first column of bl7 into x
        y5 = file5(:,2);     %  and second column into y
        while file5(counter5, 2)>dose
            counter5=counter5+1;
        end
    end

%     % code to display the appropriate values
    for n=1:5
        if index(n)== 1
            if n==1
                set(handles.percent1StructC,'String', file1(counter,1)/100);
            elseif n==2
                set(handles.percent2StructC,'String', file1(counter,1)/100);
            elseif n==3
                set(handles.percent3StructC,'String', file1(counter,1)/100);
            elseif n==4
                set(handles.percent4StructC,'String', file1(counter,1)/100);
            else 
                set(handles.percent5StructC,'String', file1(counter,1)/100);
            end
        elseif index(n)==2
            if n==1
                set(handles.percent1StructC,'String', file2(counter2,1)/100);
            elseif n==2
                set(handles.percent2StructC,'String', file2(counter2,1)/100);
            elseif n==3
                set(handles.percent3StructC,'String', file2(counter2,1)/100);
            elseif n==4
                set(handles.percent4StructC,'String', file2(counter2,1)/100);
            else 
                set(handles.percent5StructC,'String', file2(counter2,1)/100);
            end    
        elseif index(n)== 3
            if n==1
                set(handles.percent1StructC,'String', file3(counter3,1)/100);
            elseif n==2
                set(handles.percent2StructC,'String', file3(counter3,1)/100);
            elseif n==3
                set(handles.percent3StructC,'String', file3(counter3,1)/100);
            elseif n==4
                set(handles.percent4StructC,'String', file3(counter3,1)/100);
            else 
                set(handles.percent5StructC,'String', file3(counter3,1)/100);
            end
        elseif index(n)==4
            if n==1
                set(handles.percent1StructC,'String', file4(counter4,1)/100);
            elseif n==2
                set(handles.percent2StructC,'String', file4(counter4,1)/100);
            elseif n==3
                set(handles.percent3StructC,'String', file4(counter4,1)/100);
            elseif n==4
                set(handles.percent4StructC,'String', file4(counter4,1)/100);
            else 
                set(handles.percent5StructC,'String', file4(counter4,1)/100);
            end
        else
            if n==1
                set(handles.percent1StructC,'String', file5(counter5,1)/100);
            elseif n==2
                set(handles.percent2StructC,'String', file5(counter5,1)/100);
            elseif n==3
                set(handles.percent3StructC,'String', file5(counter5,1)/100);
            elseif n==4
                set(handles.percent4StructC,'String', file5(counter5,1)/100);
            else 
                set(handles.percent5StructC,'String', file5(counter5,1)/100);
            end
        end
    end

end; % end if
    
    
% --- Executes during object creation, after setting all properties.
function popupSortA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupSortA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbuttonSortStructA.
function pushbuttonSortStructA_Callback(hObject, eventdata, handles, varargin)
% hObject    handle to pushbuttonSortStructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


function plan1StructA_Callback(hObject, eventdata, handles)
% hObject    handle to plan1StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan1StructA as text
%        str2double(get(hObject,'String')) returns contents of plan1StructA as a double


% --- Executes during object creation, after setting all properties.
function plan1StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan1StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function plan2StructA_Callback(hObject, eventdata, handles)
% hObject    handle to plan2StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan2StructA as text
%        str2double(get(hObject,'String')) returns contents of plan2StructA as a double


% --- Executes during object creation, after setting all properties.
function plan2StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan2StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% Hints: get(hObject,'String') returns contents of percent1StructA as text
%        str2double(get(hObject,'String')) returns contents of percent1StructA as a double

function plan3StructA_Callback(hObject, eventdata, handles)
% hObject    handle to plan3StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan3StructA as text
%        str2double(get(hObject,'String')) returns contents of plan3StructA as a double


% --- Executes during object creation, after setting all properties.
function plan3StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan3StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function plan4StructA_Callback(hObject, eventdata, handles)
% hObject    handle to plan4StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan4StructA as text
%        str2double(get(hObject,'String')) returns contents of plan4StructA as a double


% --- Executes during object creation, after setting all properties.
function plan4StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan4StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function plan5StructA_Callback(hObject, eventdata, handles)
% hObject    handle to plan5StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan5StructA as text
%        str2double(get(hObject,'String')) returns contents of plan5StructA as a double


% --- Executes during object creation, after setting all properties.
function plan5StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan5StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes during object creation, after setting all properties.
function percent1StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent1StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function percent2StructA_Callback(hObject, eventdata, handles)
% hObject    handle to percent2StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent2StructA as text
%        str2double(get(hObject,'String')) returns contents of percent2StructA as a double


% --- Executes during object creation, after setting all properties.
function percent2StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent2StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function percent3StructA_Callback(hObject, eventdata, handles)
% hObject    handle to percent3StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent3StructA as text
%        str2double(get(hObject,'String')) returns contents of percent3StructA as a double


% --- Executes during object creation, after setting all properties.
function percent3StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent3StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function percent4StructA_Callback(hObject, eventdata, handles)
% hObject    handle to percent4StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent4StructA as text
%        str2double(get(hObject,'String')) returns contents of percent4StructA as a double


% --- Executes during object creation, after setting all properties.
function percent4StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent4StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function percent5StructA_Callback(hObject, eventdata, handles)
% hObject    handle to percent5StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent5StructA as text
%        str2double(get(hObject,'String')) returns contents of percent5StructA as a double


% --- Executes during object creation, after setting all properties.
function percent5StructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent5StructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

%----------------------------------------------------------------------
%---Struct B data manipulation

function plan1StructB_Callback(hObject, eventdata, handles)
% hObject    handle to plan1StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan1StructB as text
%        str2double(get(hObject,'String')) returns contents of plan1StructB as a double


% --- Executes during object creation, after setting all properties.
function plan1StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan1StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in popupmenuStructB.
function popupmenuStructB_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenuStructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenuStructB contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenuStructB


% --- Executes during object creation, after setting all properties.
function popupmenuStructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenuStructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in popupmenuDoseB.
function popupmenuDoseB_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenuDoseB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenuDoseB contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenuDoseB


% --- Executes during object creation, after setting all properties.
function popupmenuDoseB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenuDoseB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function percent1StructB_Callback(hObject, eventdata, handles)
% hObject    handle to percent1StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent1StructB as text
%        str2double(get(hObject,'String')) returns contents of percent1StructB as a double


% --- Executes during object creation, after setting all properties.
function percent1StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent1StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function plan2StructB_Callback(hObject, eventdata, handles)
% hObject    handle to plan2StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan2StructB as text
%        str2double(get(hObject,'String')) returns contents of plan2StructB as a double


% --- Executes during object creation, after setting all properties.
function plan2StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan2StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function percent2StructB_Callback(hObject, eventdata, handles)
% hObject    handle to percent2StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent2StructB as text
%        str2double(get(hObject,'String')) returns contents of percent2StructB as a double


% --- Executes during object creation, after setting all properties.
function percent2StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent2StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function percent3StructB_Callback(hObject, eventdata, handles)
% hObject    handle to percent3StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent3StructB as text
%        str2double(get(hObject,'String')) returns contents of percent3StructB as a double


% --- Executes during object creation, after setting all properties.
function percent3StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent3StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function plan4StructB_Callback(hObject, eventdata, handles)
% hObject    handle to plan4StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan4StructB as text
%        str2double(get(hObject,'String')) returns contents of plan4StructB as a double


% --- Executes during object creation, after setting all properties.
function plan4StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan4StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function percent4StructB_Callback(hObject, eventdata, handles)
% hObject    handle to percent4StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent4StructB as text
%        str2double(get(hObject,'String')) returns contents of percent4StructB as a double


% --- Executes during object creation, after setting all properties.
function percent4StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent4StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function plan5StructB_Callback(hObject, eventdata, handles)
% hObject    handle to plan5StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan5StructB as text
%        str2double(get(hObject,'String')) returns contents of plan5StructB as a double


% --- Executes during object creation, after setting all properties.
function plan5StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan5StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function percent5StructB_Callback(hObject, eventdata, handles)
% hObject    handle to percent5StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent5StructB as text
%        str2double(get(hObject,'String')) returns contents of percent5StructB as a double


% --- Executes during object creation, after setting all properties.
function percent5StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent5StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbuttonCalculateStructB.
function pushbuttonCalculateStructB_Callback(hObject, eventdata, handles, varargin)
% hObject    handle to pushbuttonCalculateStructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
val = get(handles.popupmenuStructB,'Value');
dose= str2double(get(handles.doseStructB, 'String'))/100;
ranking=[1:5];
%new

switch val %the structure
    %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    case 1 %for structure 1
        x=0;y=0;
        counter=1;
        f1= get(handles.file1Struct1_label, 'String');
        if not(isequal(size(f1),[1,0])) % check that there is a file to load
            file1= load(f1); %load bl6;     %  read data into the bl6 matrix
            x = file1(:,1);     %  copy first column of bl6 into x
            y = file1(:,2);     %  and second column into y
            while file1(counter, 2)>dose
                counter=counter+1;
            end
        end
        %starting at the largest value in the dose column, work down until get past
        %the dose requested.

        x2=0;y2=0;
        counter2=1;
        f2= get(handles.file2Struct1_label, 'String');
        if not(isequal(size(f2),[1 0]))
            file2=load(f2);     %  read data into the bl7 matrix
            x2 = file2(:,1);     %  copy first column of bl7 into x
            y2 = file2(:,2);     %  and second column into y
            while file2(counter2, 2)>dose
               counter2=counter2+1;
            end
        end

        x3=0;y3=0;
        counter3=1;
        f3= get(handles.file3Struct1_label, 'String');
        if not(isequal(size(f3),[1 0]))
            file3=load(f3);     %  read data into the bl7 matrix
            x3 = file3(:,1);     %  copy first column of bl7 into x
            y3 = file3(:,2);     %  and second column into y
            while file3(counter3, 2)>dose
                counter3=counter3+1;
            end
        end

        x4=0;y4=0;
        counter4=1;
        f4= get(handles.file4Struct1_label, 'String');
        if not(isequal(size(f4),[1 0]))
            file4=load(f4);     %  read data into the bl7 matrix
            x4 = file4(:,1);     %  copy first column of bl7 into x
            y4 = file4(:,2);     %  and second column into y
            while file4(counter4, 2)>dose
                counter4=counter4+1;
            end
        end

        x5=0;y5=0;
        counter5=1;
        f5= get(handles.file5Struct1_label, 'String');
        if not(isequal(size(f5),[1 0]))
            file5=load(f5);     %  read data into the bl7 matrix
            x5 = file5(:,1);     %  copy first column of bl7 into x
            y5 = file5(:,2);     %  and second column into y
            while file5(counter5, 2)>dose
                counter5=counter5+1;
            end
        end
        % code to display the appropriate values
        set(handles.percent1StructB,'String', file1(counter,1)/100);
        set(handles.percent2StructB,'String', file2(counter2,1)/100);
        set(handles.percent3StructB,'String', file3(counter3,1)/100);
        set(handles.percent4StructB,'String', file4(counter4,1)/100);
        set(handles.percent5StructB,'String', file5(counter5,1)/100);
        set(handles.plan1StructB, 'String', ranking(1));
        set(handles.plan2StructB, 'String', ranking(2));
        set(handles.plan3StructB, 'String', ranking(3));
        set(handles.plan4StructB, 'String', ranking(4));
        set(handles.plan5StructB, 'String', ranking(5));
    %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    case 2 %for structure 2
        x=0;y=0;
        counter=1;
        f1= get(handles.file1Struct2_label, 'String');
        if not(isequal(size(f1),[1,0])) % check that there is a file to load
            file1= load(f1); %load bl6;     %  read data into the bl6 matrix
            x = file1(:,1);     %  copy first column of bl6 into x
            y = file1(:,2);     %  and second column into y
            while file1(counter, 2)>dose
                counter=counter+1;
            end
        end
        %starting at the largest value in the dose column, work down until get past
        %the dose requested.

        x2=0;y2=0;
        counter2=1;
        f2= get(handles.file2Struct2_label, 'String');
        if not(isequal(size(f2),[1 0]))
            file2=load(f2);     %  read data into the bl7 matrix
            x2 = file2(:,1);     %  copy first column of bl7 into x
            y2 = file2(:,2);     %  and second column into y
            while file2(counter2, 2)>dose
               counter2=counter2+1;
            end
        end

        x3=0;y3=0;
        counter3=1;
        f3= get(handles.file3Struct2_label, 'String');
        if not(isequal(size(f3),[1 0]))
            file3=load(f3);     %  read data into the bl7 matrix
            x3 = file3(:,1);     %  copy first column of bl7 into x
            y3 = file3(:,2);     %  and second column into y
            while file3(counter3, 2)>dose
                counter3=counter3+1;
            end
        end

        x4=0;y4=0;
        counter4=1;
        f4= get(handles.file4Struct2_label, 'String');
        if not(isequal(size(f4),[1 0]))
            file4=load(f4);     %  read data into the bl7 matrix
            x4 = file4(:,1);     %  copy first column of bl7 into x
            y4 = file4(:,2);     %  and second column into y
            while file4(counter4, 2)>dose
                counter4=counter4+1;
            end
        end

        x5=0;y5=0;
        counter5=1;
        f5= get(handles.file5Struct2_label, 'String');
        if not(isequal(size(f5),[1 0]))
            file5=load(f5);     %  read data into the bl7 matrix
            x5 = file5(:,1);     %  copy first column of bl7 into x
            y5 = file5(:,2);     %  and second column into y
            while file5(counter5, 2)>dose
                counter5=counter5+1;
            end
        end
        % code to display the appropriate values
        set(handles.percent1StructB,'String', file1(counter,1)/100);
        set(handles.percent2StructB,'String', file2(counter2,1)/100);
        set(handles.percent3StructB,'String', file3(counter3,1)/100);
        set(handles.percent4StructB,'String', file4(counter4,1)/100);
        set(handles.percent5StructB,'String', file5(counter5,1)/100);
        set(handles.plan1StructB, 'String', ranking(1));
        set(handles.plan2StructB, 'String', ranking(2));
        set(handles.plan3StructB, 'String', ranking(3));
        set(handles.plan4StructB, 'String', ranking(4));
        set(handles.plan5StructB, 'String', ranking(5));
   %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
   case 3 %for structure 3
        x=0;y=0;
        counter=1;
        f1= get(handles.file1Struct3_label, 'String');
        if not(isequal(size(f1),[1,0])) % check that there is a file to load
            file1= load(f1); %load bl6;     %  read data into the bl6 matrix
            x = file1(:,1);     %  copy first column of bl6 into x
            y = file1(:,2);     %  and second column into y
            while file1(counter, 2)>dose
                counter=counter+1;
            end
        end
        %starting at the largest value in the dose column, work down until get past
        %the dose requested.

        x2=0;y2=0;
        counter2=1;
        f2= get(handles.file2Struct3_label, 'String');
        if not(isequal(size(f2),[1 0]))
            file2=load(f2);     %  read data into the bl7 matrix
            x2 = file2(:,1);     %  copy first column of bl7 into x
            y2 = file2(:,2);     %  and second column into y
            while file2(counter2, 2)>dose
               counter2=counter2+1;
            end
        end

        x3=0;y3=0;
        counter3=1;
        f3= get(handles.file3Struct3_label, 'String');
        if not(isequal(size(f3),[1 0]))
            file3=load(f3);     %  read data into the bl7 matrix
            x3 = file3(:,1);     %  copy first column of bl7 into x
            y3 = file3(:,2);     %  and second column into y
            while file3(counter3, 2)>dose
                counter3=counter3+1;
            end
        end

        x4=0;y4=0;
        counter4=1;
        f4= get(handles.file4Struct3_label, 'String');
        if not(isequal(size(f4),[1 0]))
            file4=load(f4);     %  read data into the bl7 matrix
            x4 = file4(:,1);     %  copy first column of bl7 into x
            y4 = file4(:,2);     %  and second column into y
            while file4(counter4, 2)>dose
                counter4=counter4+1;
            end
        end

        x5=0;y5=0;
        counter5=1;
        f5= get(handles.file5Struct3_label, 'String');
        if not(isequal(size(f5),[1 0]))
            file5=load(f5);     %  read data into the bl7 matrix
            x5 = file5(:,1);     %  copy first column of bl7 into x
            y5 = file5(:,2);     %  and second column into y
            while file5(counter5, 2)>dose
                counter5=counter5+1;
            end
        end
        % code to display the appropriate values
        set(handles.percent1StructB,'String', file1(counter,1)/100);
        set(handles.percent2StructB,'String', file2(counter2,1)/100);
        set(handles.percent3StructB,'String', file3(counter3,1)/100);
        set(handles.percent4StructB,'String', file4(counter4,1)/100);
        set(handles.percent5StructB,'String', file5(counter5,1)/100);
        set(handles.plan1StructB, 'String', ranking(1));
        set(handles.plan2StructB, 'String', ranking(2));
        set(handles.plan3StructB, 'String', ranking(3));
        set(handles.plan4StructB, 'String', ranking(4));
        set(handles.plan5StructB, 'String', ranking(5));
end

% --- Executes on selection change in popupSortB.
function popupSortB_Callback(hObject, eventdata, handles)
% hObject    handle to popupSortB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupSortB contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupSortB
percent=[str2double(get(handles.percent1StructB, 'String')) 1
    str2double(get(handles.percent2StructB, 'String')) 2
    str2double(get(handles.percent3StructB, 'String')) 3
    str2double(get(handles.percent4StructB, 'String')) 4
    str2double(get(handles.percent5StructB, 'String')) 5]
[B,index]= sortrows(percent, 1) %sortedPercent= sort(percent, 1)
% reprint the now sorted rows and columns
set(handles.plan1StructB, 'String', index(1));
set(handles.plan2StructB, 'String', index(2));
set(handles.plan3StructB, 'String', index(3));
set(handles.plan4StructB, 'String', index(4));
set(handles.plan5StructB, 'String', index(5));
set(handles.percent1StructB,'String', B(1,1));
set(handles.percent2StructB,'String', B(2,1));
set(handles.percent3StructB,'String', B(3,1));
set(handles.percent4StructB,'String', B(4,1));
set(handles.percent5StructB,'String', B(5,1));

val = get(handles.popupSortB,'Value');
if (val==2)
  set(handles.plan1StructA, 'String', index(1));
  set(handles.plan2StructA, 'String', index(2));
  set(handles.plan3StructA, 'String', index(3));
  set(handles.plan4StructA, 'String', index(4));
  set(handles.plan5StructA, 'String', index(5));
  set(handles.plan1StructC, 'String', index(1));
  set(handles.plan2StructC, 'String', index(2));
  set(handles.plan3StructC, 'String', index(3));
  set(handles.plan4StructC, 'String', index(4));
  set(handles.plan5StructC, 'String', index(5));
end;

% --- Executes during object creation, after setting all properties.
function popupSortB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupSortB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

%----------------------------------------------------------------------
%---Struct C data manipulation

function plan1StructC_Callback(hObject, eventdata, handles)
% hObject    handle to plan1StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan1StructC as text
%        str2double(get(hObject,'String')) returns contents of plan1StructC as a double


% --- Executes during object creation, after setting all properties.
function plan1StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan1StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on selection change in popupmenuStructC.
function popupmenuStructC_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenuStructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenuStructC contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenuStructC


% --- Executes during object creation, after setting all properties.
function popupmenuStructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenuStructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in popupmenuDoseC.
function popupmenuDoseC_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenuDoseC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenuDoseC contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenuDoseC


% --- Executes during object creation, after setting all properties.
function popupmenuDoseC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenuDoseC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function percent1StructC_Callback(hObject, eventdata, handles)
% hObject    handle to percent1StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent1StructC as text
%        str2double(get(hObject,'String')) returns contents of percent1StructC as a double


% --- Executes during object creation, after setting all properties.
function percent1StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent1StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function plan2StructC_Callback(hObject, eventdata, handles)
% hObject    handle to plan2StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan2StructC as text
%        str2double(get(hObject,'String')) returns contents of plan2StructC as a double


% --- Executes during object creation, after setting all properties.
function plan2StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan2StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function percent2StructC_Callback(hObject, eventdata, handles)
% hObject    handle to percent2StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent2StructC as text
%        str2double(get(hObject,'String')) returns contents of percent2StructC as a double


% --- Executes during object creation, after setting all properties.
function percent2StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent2StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function plan3StructC_Callback(hObject, eventdata, handles)
% hObject    handle to plan3StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan3StructC as text
%        str2double(get(hObject,'String')) returns contents of plan3StructC as a double


% --- Executes during object creation, after setting all properties.
function plan3StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan3StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function percent3StructC_Callback(hObject, eventdata, handles)
% hObject    handle to percent3StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent3StructC as text
%        str2double(get(hObject,'String')) returns contents of percent3StructC as a double


% --- Executes during object creation, after setting all properties.
function percent3StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent3StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function plan4StructC_Callback(hObject, eventdata, handles)
% hObject    handle to plan4StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan4StructC as text
%        str2double(get(hObject,'String')) returns contents of plan4StructC as a double


% --- Executes during object creation, after setting all properties.
function plan4StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan4StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function percent4StructC_Callback(hObject, eventdata, handles)
% hObject    handle to percent4StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent4StructC as text
%        str2double(get(hObject,'String')) returns contents of percent4StructC as a double


% --- Executes during object creation, after setting all properties.
function percent4StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent4StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function plan5StructC_Callback(hObject, eventdata, handles)
% hObject    handle to plan5StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan5StructC as text
%        str2double(get(hObject,'String')) returns contents of plan5StructC as a double


% --- Executes during object creation, after setting all properties.
function plan5StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan5StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function percent5StructC_Callback(hObject, eventdata, handles)
% hObject    handle to percent5StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of percent5StructC as text
%        str2double(get(hObject,'String')) returns contents of percent5StructC as a double


% --- Executes during object creation, after setting all properties.
function percent5StructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to percent5StructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbuttonCalculateStructC.
function pushbuttonCalculateStructC_Callback(hObject, eventdata, handles, varargin)
% hObject    handle to pushbuttonCalculateStructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
val = get(handles.popupmenuStructC,'Value');
dose= str2double(get(handles.doseStructC, 'String'))/100;
ranking=[1:5];
%new

switch val %the structure
    %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    case 1 %for structure 1
        x=0;y=0;
        counter=1;
        f1= get(handles.file1Struct1_label, 'String');
        if not(isequal(size(f1),[1,0])) % check that there is a file to load
            file1= load(f1); %load bl6;     %  read data into the bl6 matrix
            x = file1(:,1);     %  copy first column of bl6 into x
            y = file1(:,2);     %  and second column into y
            while file1(counter, 2)>dose
                counter=counter+1;
            end
        end
        %starting at the largest value in the dose column, work down until get past
        %the dose requested.

        x2=0;y2=0;
        counter2=1;
        f2= get(handles.file2Struct1_label, 'String');
        if not(isequal(size(f2),[1 0]))
            file2=load(f2);     %  read data into the bl7 matrix
            x2 = file2(:,1);     %  copy first column of bl7 into x
            y2 = file2(:,2);     %  and second column into y
            while file2(counter2, 2)>dose
               counter2=counter2+1;
            end
        end

        x3=0;y3=0;
        counter3=1;
        f3= get(handles.file3Struct1_label, 'String');
        if not(isequal(size(f3),[1 0]))
            file3=load(f3);     %  read data into the bl7 matrix
            x3 = file3(:,1);     %  copy first column of bl7 into x
            y3 = file3(:,2);     %  and second column into y
            while file3(counter3, 2)>dose
                counter3=counter3+1;
            end
        end

        x4=0;y4=0;
        counter4=1;
        f4= get(handles.file4Struct1_label, 'String');
        if not(isequal(size(f4),[1 0]))
            file4=load(f4);     %  read data into the bl7 matrix
            x4 = file4(:,1);     %  copy first column of bl7 into x
            y4 = file4(:,2);     %  and second column into y
            while file4(counter4, 2)>dose
                counter4=counter4+1;
            end
        end

        x5=0;y5=0;
        counter5=1;
        f5= get(handles.file5Struct1_label, 'String');
        if not(isequal(size(f5),[1 0]))
            file5=load(f5);     %  read data into the bl7 matrix
            x5 = file5(:,1);     %  copy first column of bl7 into x
            y5 = file5(:,2);     %  and second column into y
            while file5(counter5, 2)>dose
                counter5=counter5+1;
            end
        end
        % code to display the appropriate values
        set(handles.percent1StructC,'String', file1(counter,1)/100);
        set(handles.percent2StructC,'String', file2(counter2,1)/100);
        set(handles.percent3StructC,'String', file3(counter3,1)/100);
        set(handles.percent4StructC,'String', file4(counter4,1)/100);
        set(handles.percent5StructC,'String', file5(counter5,1)/100);
        set(handles.plan1StructC, 'String', ranking(1));
        set(handles.plan2StructC, 'String', ranking(2));
        set(handles.plan3StructC, 'String', ranking(3));
        set(handles.plan4StructC, 'String', ranking(4));
        set(handles.plan5StructC, 'String', ranking(5));
    %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
    case 2 %for structure 2
        x=0;y=0;
        counter=1;
        f1= get(handles.file1Struct2_label, 'String');
        if not(isequal(size(f1),[1,0])) % check that there is a file to load
            file1= load(f1); %load bl6;     %  read data into the bl6 matrix
            x = file1(:,1);     %  copy first column of bl6 into x
            y = file1(:,2);     %  and second column into y
            while file1(counter, 2)>dose
                counter=counter+1;
            end
        end
        %starting at the largest value in the dose column, work down until get past
        %the dose requested.

        x2=0;y2=0;
        counter2=1;
        f2= get(handles.file2Struct2_label, 'String');
        if not(isequal(size(f2),[1 0]))
            file2=load(f2);     %  read data into the bl7 matrix
            x2 = file2(:,1);     %  copy first column of bl7 into x
            y2 = file2(:,2);     %  and second column into y
            while file2(counter2, 2)>dose
               counter2=counter2+1;
            end
        end

        x3=0;y3=0;
        counter3=1;
        f3= get(handles.file3Struct2_label, 'String');
        if not(isequal(size(f3),[1 0]))
            file3=load(f3);     %  read data into the bl7 matrix
            x3 = file3(:,1);     %  copy first column of bl7 into x
            y3 = file3(:,2);     %  and second column into y
            while file3(counter3, 2)>dose
                counter3=counter3+1;
            end
        end

        x4=0;y4=0;
        counter4=1;
        f4= get(handles.file4Struct2_label, 'String');
        if not(isequal(size(f4),[1 0]))
            file4=load(f4);     %  read data into the bl7 matrix
            x4 = file4(:,1);     %  copy first column of bl7 into x
            y4 = file4(:,2);     %  and second column into y
            while file4(counter4, 2)>dose
                counter4=counter4+1;
            end
        end

        x5=0;y5=0;
        counter5=1;
        f5= get(handles.file5Struct2_label, 'String');
        if not(isequal(size(f5),[1 0]))
            file5=load(f5);     %  read data into the bl7 matrix
            x5 = file5(:,1);     %  copy first column of bl7 into x
            y5 = file5(:,2);     %  and second column into y
            while file5(counter5, 2)>dose
                counter5=counter5+1;
            end
        end
        % code to display the appropriate values
        set(handles.percent1StructC,'String', file1(counter,1)/100);
        set(handles.percent2StructC,'String', file2(counter2,1)/100);
        set(handles.percent3StructC,'String', file3(counter3,1)/100);
        set(handles.percent4StructC,'String', file4(counter4,1)/100);
        set(handles.percent5StructC,'String', file5(counter5,1)/100);
        set(handles.plan1StructC, 'String', ranking(1));
        set(handles.plan2StructC, 'String', ranking(2));
        set(handles.plan3StructC, 'String', ranking(3));
        set(handles.plan4StructC, 'String', ranking(4));
        set(handles.plan5StructC, 'String', ranking(5));
   %-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
   case 3 %for structure 3
        x=0;y=0;
        counter=1;
        f1= get(handles.file1Struct3_label, 'String');
        if not(isequal(size(f1),[1,0])) % check that there is a file to load
            file1= load(f1); %load bl6;     %  read data into the bl6 matrix
            x = file1(:,1);     %  copy first column of bl6 into x
            y = file1(:,2);     %  and second column into y
            while file1(counter, 2)>dose
                counter=counter+1;
            end
        end
        %starting at the largest value in the dose column, work down until get past
        %the dose requested.

        x2=0;y2=0;
        counter2=1;
        f2= get(handles.file2Struct3_label, 'String');
        if not(isequal(size(f2),[1 0]))
            file2=load(f2);     %  read data into the bl7 matrix
            x2 = file2(:,1);     %  copy first column of bl7 into x
            y2 = file2(:,2);     %  and second column into y
            while file2(counter2, 2)>dose
               counter2=counter2+1;
            end
        end

        x3=0;y3=0;
        counter3=1;
        f3= get(handles.file3Struct3_label, 'String');
        if not(isequal(size(f3),[1 0]))
            file3=load(f3);     %  read data into the bl7 matrix
            x3 = file3(:,1);     %  copy first column of bl7 into x
            y3 = file3(:,2);     %  and second column into y
            while file3(counter3, 2)>dose
                counter3=counter3+1;
            end
        end

        x4=0;y4=0;
        counter4=1;
        f4= get(handles.file4Struct3_label, 'String');
        if not(isequal(size(f4),[1 0]))
            file4=load(f4);     %  read data into the bl7 matrix
            x4 = file4(:,1);     %  copy first column of bl7 into x
            y4 = file4(:,2);     %  and second column into y
            while file4(counter4, 2)>dose
                counter4=counter4+1;
            end
        end

        x5=0;y5=0;
        counter5=1;
        f5= get(handles.file5Struct3_label, 'String');
        if not(isequal(size(f5),[1 0]))
            file5=load(f5);     %  read data into the bl7 matrix
            x5 = file5(:,1);     %  copy first column of bl7 into x
            y5 = file5(:,2);     %  and second column into y
            while file5(counter5, 2)>dose
                counter5=counter5+1;
            end
        end
        % code to display the appropriate values
        set(handles.percent1StructC,'String', file1(counter,1)/100);
        set(handles.percent2StructC,'String', file2(counter2,1)/100);
        set(handles.percent3StructC,'String', file3(counter3,1)/100);
        set(handles.percent4StructC,'String', file4(counter4,1)/100);
        set(handles.percent5StructC,'String', file5(counter5,1)/100);
        set(handles.plan1StructC, 'String', ranking(1));
        set(handles.plan2StructC, 'String', ranking(2));
        set(handles.plan3StructC, 'String', ranking(3));
        set(handles.plan4StructC, 'String', ranking(4));
        set(handles.plan5StructC, 'String', ranking(5));
end


% --- Executes on selection change in popupSortC.
function popupSortC_Callback(hObject, eventdata, handles)
% hObject    handle to popupSortC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupSortC contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupSortC
percent=[str2double(get(handles.percent1StructC, 'String')) 1
    str2double(get(handles.percent2StructC, 'String')) 2
    str2double(get(handles.percent3StructC, 'String')) 3
    str2double(get(handles.percent4StructC, 'String')) 4
    str2double(get(handles.percent5StructC, 'String')) 5]
[B,index]= sortrows(percent, 1) %sortedPercent= sort(percent, 1)
% reprint the now sorted rows and columns
set(handles.plan1StructC, 'String', index(1));
set(handles.plan2StructC, 'String', index(2));
set(handles.plan3StructC, 'String', index(3));
set(handles.plan4StructC, 'String', index(4));
set(handles.plan5StructC, 'String', index(5));
set(handles.percent1StructC,'String', B(1,1));
set(handles.percent2StructC,'String', B(2,1));
set(handles.percent3StructC,'String', B(3,1));
set(handles.percent4StructC,'String', B(4,1));
set(handles.percent5StructC,'String', B(5,1));

val = get(handles.popupSortC,'Value');
if (val==2)
  set(handles.plan1StructA, 'String', index(1));
  set(handles.plan2StructA, 'String', index(2));
  set(handles.plan3StructA, 'String', index(3));
  set(handles.plan4StructA, 'String', index(4));
  set(handles.plan5StructA, 'String', index(5));
  set(handles.plan1StructB, 'String', index(1));
  set(handles.plan2StructB, 'String', index(2));
  set(handles.plan3StructB, 'String', index(3));
  set(handles.plan4StructB, 'String', index(4));
  set(handles.plan5StructB, 'String', index(5));
end;

% --- Executes during object creation, after setting all properties.
function popupSortC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupSortC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

%------------------------------------------------------------------------
%--- handling the bottom Structure 1

% --- Executes on slider movement.
function sliderDose1Struct1_Callback(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
guidata(hObject, handles);
set(handles.dose1Struct1,'String', num2str(get(handles.sliderDose1Struct1,'Value')));


% --- Executes during object creation, after setting all properties.
function sliderDose1Struct1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end

% --- Executes on slider movement.
function dose1Struct1_Callback(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
val = str2double(get(handles.dose1Struct1,'String'));
% Determine whether val is a number between 0 and 1
if isnumeric(val) & val >= get(handles.sliderDose1Struct1,'Min') & val <= get(handles.sliderDose1Struct1,'Max')
    set(handles.sliderDose1Struct1,'Value',val);
end

function dose1Struct1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to dose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on slider movement.
function sliderDose2Struct1_Callback(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
guidata(hObject, handles);
set(handles.dose2Struct1,'String', num2str(get(handles.sliderDose2Struct1,'Value')));

% --- Executes during object creation, after setting all properties.
function sliderDose2Struct1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


function dose2Struct1_Callback(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
val = str2double(get(handles.dose2Struct1,'String'));
% Determine whether val is a number between 0 and 1
if isnumeric(val) & val >= get(handles.sliderDose2Struct1,'Min') & val <= get(handles.sliderDose2Struct1,'Max')
    set(handles.sliderDose2Struct1,'Value',val);
end

function dose2Struct1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to dose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbuttonStruct1.
function pushbuttonStruct1_Callback(hObject, eventdata, handles, varargin)
% hObject    handle to pushbuttonStruct1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
d1st1= str2double(get(handles.dose1Struct1, 'String'));
d2st1= str2double(get(handles.dose2Struct1, 'String'));

% create first plot
f1= get(handles.file1Struct1_label, 'String');
x=0;y=0;
s=size(f1);
if not(isequal(size(f1),[1 0]))
  file1= load(f1); %load bl6;     %  read data into the bl6 matrix
  x = file1(:,1);     %  copy first column of bl6 into x
  y = file1(:,2);     %  and second column into y
end
x2=0;y2=0;
f2= get(handles.file2Struct1_label, 'String');
if not(isequal(size(f2),[1 0]))
  file2=load(f2);     %  read data into the bl7 matrix
  x2 = file2(:,1);     %  copy first column of bl7 into x
  y2 = file2(:,2);     %  and second column into y
end

lenY= length(y); %vectors; len(y)==len(y2)
% loop though the percentage (y) until pass d1st1/100, draw the line
i= 1;
while ( ((d1st1/100) < y(i)) && (i<=lenY) )
    i=i+1;
end
% i is the postition for the line
j= 1;
while ( ((d2st1/100) < y(j)) && (j<=lenY) )
    j=j+1;
end
% j is the position for the line
f1=figure();  %needed to make plot be in another window
y3=linspace(0,100, 500);
plot(x/100,y*100, 'k-', x2/100,y2*100, 'k:', x(i)/100,y3, 'k-', x2(j)/100,y3, 'k-') % /100 to convert cGy to Gy
fprintf('plotting');

axis([0 110 0 100])
title('Structure Plan Comparison', 'FontSize', 18, 'FontWeight', 'bold')
legend('plan 1', 'plan 2')
ylabel('Percent of Organ Volume Receiving Dose', 'FontSize', 13, 'FontWeight', 'bold')
xlabel('Gy', 'FontSize', 13, 'FontWeight', 'bold')
grid off;

%------------------------------------------------------------------------
%--- handling the bottom Structure 2

% --- Executes on slider movement.
function sliderDose1Struct2_Callback(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
guidata(hObject, handles);
set(handles.dose1Struct2,'String', num2str(get(handles.sliderDose1Struct2,'Value')));

% --- Executes during object creation, after setting all properties.
function sliderDose1Struct2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end

% --- Executes on slider movement.
function sliderDose2Struct2_Callback(hObject, eventdata, handles)
% hObject    handle to sliderDose2Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
guidata(hObject, handles);
set(handles.dose2Struct2,'String', num2str(get(handles.sliderDose2Struct2,'Value')));

% --- Executes during object creation, after setting all properties.
function sliderDose2Struct2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderDose2Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


function dose1Struct2_Callback(hObject, eventdata, handles)
% hObject    handle to dose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of dose1Struct2 as text
%        str2double(get(hObject,'String')) returns contents of dose1Struct2 as a double
val = str2double(get(handles.dose1Struct2,'String'));
% Determine whether val is a number between 0 and 1
if isnumeric(val) & val >= get(handles.sliderDose1Struct2,'Min') & val <= get(handles.sliderDose1Struct2,'Max')
    set(handles.sliderDose1Struct2,'Value',val);
end

% --- Executes during object creation, after setting all properties.
function dose1Struct2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to dose1Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function dose2Struct2_Callback(hObject, eventdata, handles)
% hObject    handle to dose2Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of dose2Struct2 as text
%        str2double(get(hObject,'String')) returns contents of dose2Struct2 as a double
val = str2double(get(handles.dose2Struct2,'String'));
% Determine whether val is a number between 0 and 1
if isnumeric(val) & val >= get(handles.sliderDose2Struct2,'Min') & val <= get(handles.sliderDose2Struct2,'Max')
    set(handles.sliderDose2Struct2,'Value',val);
end


% --- Executes during object creation, after setting all properties.
function dose2Struct2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to dose2Struct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbuttonStruct2.
function pushbuttonStruct2_Callback(hObject, eventdata, handles, varargin)
% hObject    handle to pushbuttonStruct2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
d1st2= str2double(get(handles.dose1Struct2, 'String'));
d2st2= str2double(get(handles.dose2Struct2, 'String'));
% create first plot
f1= get(handles.file1Struct2_label, 'String');
x=0;y=0;
s=size(f1);
if not(isequal(size(f1),[1 0]))
  file1= load(f1); %load bl6;     %  read data into the bl6 matrix
  x = file1(:,1);     %  copy first column of bl6 into x
  y = file1(:,2);     %  and second column into y
end
x2=0;y2=0;
f2= get(handles.file2Struct2_label, 'String');
if not(isequal(size(f2),[1 0]))
  file2=load(f2);     %  read data into the bl7 matrix
  x2 = file2(:,1);     %  copy first column of bl7 into x
  y2 = file2(:,2);     %  and second column into y
end

lenY= length(y); %vectors; len(y)==len(y2)
% loop though the percentage (y) until pass d1st1/100, draw the line
i= 1;
while ( ((d1st2/100) < y(i)) && (i<=lenY) )
    i=i+1;
end
% i is the postition for the line
j= 1;
while ( ((d2st2/100) < y(j)) && (j<=lenY) )
    j=j+1;
end
% j is the position for the line
f2=figure();  %needed to make plot be in another window
y3=linspace(0,100, 500);
p2= plot(x/100,y*100, 'k-', x2/100,y2*100, 'k:', x(i)/100,y3, 'k-', x2(j)/100,y3, 'k-'); % /100 to convert cGy to Gy
%p2= plot(x/100,y*100, 'k-', x2/100,y2*100, 'k:', x(i)/100,y*100, x2(j)/100,y2*100); % /100 to convert cGy to Gy

axis([0 110 0 100]);
title('Structure Plan Comparison', 'FontSize', 18, 'FontWeight', 'bold');
legend('plan 1', 'plan 2');
ylabel('Percent of Organ Volume Receiving Dose', 'FontSize', 13, 'FontWeight', 'bold');
xlabel('Gy', 'FontSize', 13, 'FontWeight', 'bold');
grid off;


%------------------------------------------------------------------------
%--- handling the bottom Structure 3

% --- Executes on slider movement.
function sliderDose1Struct3_Callback(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
guidata(hObject, handles);
set(handles.dose1Struct3,'String', num2str(get(handles.sliderDose1Struct3,'Value')));


% --- Executes during object creation, after setting all properties.
function sliderDose1Struct3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderDose1Struct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


function dose1Struct3_Callback(hObject, eventdata, handles)
% hObject    handle to dose1Struct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of dose1Struct3 as text
%        str2double(get(hObject,'String')) returns contents of dose1Struct3 as a double
val = str2double(get(handles.dose1Struct3,'String'));
% Determine whether val is a number between 0 and 1
if isnumeric(val) & val >= get(handles.sliderDose1Struct3,'Min') & val <= get(handles.sliderDose1Struct3,'Max')
    set(handles.sliderDose1Struct3,'Value',val);
end


% --- Executes during object creation, after setting all properties.
function dose1Struct3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to dose1Struct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on slider movement.
function sliderDose2Struct3_Callback(hObject, eventdata, handles)
% hObject    handle to sliderDose2Struct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
guidata(hObject, handles);
set(handles.dose2Struct3,'String', num2str(get(handles.sliderDose2Struct3,'Value')));


% --- Executes during object creation, after setting all properties.
function sliderDose2Struct3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to sliderDose2Struct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end



function dose2Struct3_Callback(hObject, eventdata, handles)
% hObject    handle to dose2Struct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of dose2Struct3 as text
%        str2double(get(hObject,'String')) returns contents of dose2Struct3 as a double
val = str2double(get(handles.dose2Struct3,'String'));
% Determine whether val is a number between 0 and 1
if isnumeric(val) & val >= get(handles.sliderDose2Struct3,'Min') & val <= get(handles.sliderDose2Struct3,'Max')
    set(handles.sliderDose2Struct3,'Value',val);
end


% --- Executes during object creation, after setting all properties.
function dose2Struct3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to dose2Struct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbuttonStruct3.
function pushbuttonStruct3_Callback(hObject, eventdata, handles, varargin)
% hObject    handle to pushbuttonStruct3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
d1st3= str2double(get(handles.dose1Struct3, 'String'));
d2st3= str2double(get(handles.dose2Struct3, 'String'));
% create first plot
f1= get(handles.file1Struct3_label, 'String');
x=0;y=0;
s=size(f1);
if not(isequal(size(f1),[1 0]))
  file1= load(f1); %load bl6;     %  read data into the bl6 matrix
  x = file1(:,1);     %  copy first column of bl6 into x
  y = file1(:,2);     %  and second column into y
end
x2=0;y2=0;
f2= get(handles.file2Struct3_label, 'String');
if not(isequal(size(f2),[1 0]))
  file2=load(f2);     %  read data into the bl7 matrix
  x2 = file2(:,1);     %  copy first column of bl7 into x
  y2 = file2(:,2);     %  and second column into y
end

lenY= length(y); %vectors; len(y)==len(y2)
% loop though the percentage (y) until pass d1st1/100, draw the line
i= 1;
while ( ((d1st3/100) < y(i)) && (i<=lenY) )
    i=i+1;
end
% i is the postition for the line
j= 1;
while ( ((d2st3/100) < y(j)) && (j<=lenY) )
    j=j+1;
end
% j is the position for the line
f3=figure();  %needed to make plot be in another window
y3=linspace(0,100, 500);
p3= plot(x/100,y*100, 'k-', x2/100,y2*100, 'k:', x(i)/100,y3, 'k-', x2(j)/100,y3, 'k-'); % /100 to convert cGy to Gy
%p3= plot(x/100,y*100, 'k-', x2/100,y2*100, 'k:', x(i)/100,y*100, x2(j)/100,y2*100); % /100 to convert cGy to Gy

axis([0 110 0 100]);
title('Structure Plan Comparison', 'FontSize', 18, 'FontWeight', 'bold');
legend('plan 1', 'plan 2');
ylabel('Percent of Organ Volume Receiving Dose', 'FontSize', 13, 'FontWeight', 'bold');
xlabel('Gy', 'FontSize', 13, 'FontWeight', 'bold');
grid off;


%------------------------------------------------------------------------
%------ end -------------------------------------------------------------
%------------------------------------------------------------------------


function doseStructA_Callback(hObject, eventdata, handles)
% hObject    handle to doseStructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of doseStructA as text
%        str2double(get(hObject,'String')) returns contents of doseStructA as a double


% --- Executes during object creation, after setting all properties.
function doseStructA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to doseStructA (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function doseStructB_Callback(hObject, eventdata, handles)
% hObject    handle to doseStructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of doseStructB as text
%        str2double(get(hObject,'String')) returns contents of doseStructB as a double


% --- Executes during object creation, after setting all properties.
function doseStructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to doseStructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function doseStructC_Callback(hObject, eventdata, handles)
% hObject    handle to doseStructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of doseStructC as text
%        str2double(get(hObject,'String')) returns contents of doseStructC as a double


% --- Executes during object creation, after setting all properties.
function doseStructC_CreateFcn(hObject, eventdata, handles)
% hObject    handle to doseStructC (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function plan3StructB_Callback(hObject, eventdata, handles)
% hObject    handle to plan3StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of plan3StructB as text
%        str2double(get(hObject,'String')) returns contents of plan3StructB as a double


% --- Executes during object creation, after setting all properties.
function plan3StructB_CreateFcn(hObject, eventdata, handles)
% hObject    handle to plan3StructB (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


%-----------------------------------------------------------------------
%-----------------------------------------------------------------------

function file1Struct1_label_Callback(hObject, eventdata, handles)
% hObject    handle to file1Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file1Struct1_label as text
%        str2double(get(hObject,'String')) returns contents of file1Struct1_label as a double


% --- Executes during object creation, after setting all properties.
function file1Struct1_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file1Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file2Struct1_label_Callback(hObject, eventdata, handles)
% hObject    handle to file2Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file2Struct1_label as text
%        str2double(get(hObject,'String')) returns contents of file2Struct1_label as a double


% --- Executes during object creation, after setting all properties.
function file2Struct1_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file2Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file1Struct2_label_Callback(hObject, eventdata, handles)
% hObject    handle to file1Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file1Struct2_label as text
%        str2double(get(hObject,'String')) returns contents of file1Struct2_label as a double


% --- Executes during object creation, after setting all properties.
function file1Struct2_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file1Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file2Struct2_label_Callback(hObject, eventdata, handles)
% hObject    handle to file2Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file2Struct2_label as text
%        str2double(get(hObject,'String')) returns contents of file2Struct2_label as a double


% --- Executes during object creation, after setting all properties.
function file2Struct2_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file2Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file1Struct3_label_Callback(hObject, eventdata, handles)
% hObject    handle to file1Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file1Struct3_label as text
%        str2double(get(hObject,'String')) returns contents of file1Struct3_label as a double


% --- Executes during object creation, after setting all properties.
function file1Struct3_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file1Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file2Struct3_label_Callback(hObject, eventdata, handles)
% hObject    handle to file2Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file2Struct3_label as text
%        str2double(get(hObject,'String')) returns contents of file2Struct3_label as a double


% --- Executes during object creation, after setting all properties.
function file2Struct3_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file2Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file3Struct1_label_Callback(hObject, eventdata, handles)
% hObject    handle to file3Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file3Struct1_label as text
%        str2double(get(hObject,'String')) returns contents of file3Struct1_label as a double


% --- Executes during object creation, after setting all properties.
function file3Struct1_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file3Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file4Struct1_label_Callback(hObject, eventdata, handles)
% hObject    handle to file4Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file4Struct1_label as text
%        str2double(get(hObject,'String')) returns contents of file4Struct1_label as a double


% --- Executes during object creation, after setting all properties.
function file4Struct1_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file4Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file5Struct1_label_Callback(hObject, eventdata, handles)
% hObject    handle to file5Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file5Struct1_label as text
%        str2double(get(hObject,'String')) returns contents of file5Struct1_label as a double


% --- Executes during object creation, after setting all properties.
function file5Struct1_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file5Struct1_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit53_Callback(hObject, eventdata, handles)
% hObject    handle to edit53 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit53 as text
%        str2double(get(hObject,'String')) returns contents of edit53 as a double


% --- Executes during object creation, after setting all properties.
function edit53_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit53 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file3Struct2_label_Callback(hObject, eventdata, handles)
% hObject    handle to file3Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file3Struct2_label as text
%        str2double(get(hObject,'String')) returns contents of file3Struct2_label as a double


% --- Executes during object creation, after setting all properties.
function file3Struct2_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file3Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file4Struct2_label_Callback(hObject, eventdata, handles)
% hObject    handle to file4Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file4Struct2_label as text
%        str2double(get(hObject,'String')) returns contents of file4Struct2_label as a double


% --- Executes during object creation, after setting all properties.
function file4Struct2_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file4Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file5Struct2_label_Callback(hObject, eventdata, handles)
% hObject    handle to file5Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file5Struct2_label as text
%        str2double(get(hObject,'String')) returns contents of file5Struct2_label as a double


% --- Executes during object creation, after setting all properties.
function file5Struct2_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file5Struct2_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file3Struct3_label_Callback(hObject, eventdata, handles)
% hObject    handle to file3Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file3Struct3_label as text
%        str2double(get(hObject,'String')) returns contents of file3Struct3_label as a double


% --- Executes during object creation, after setting all properties.
function file3Struct3_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file3Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file4Struct3_label_Callback(hObject, eventdata, handles)
% hObject    handle to file4Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file4Struct3_label as text
%        str2double(get(hObject,'String')) returns contents of file4Struct3_label as a double


% --- Executes during object creation, after setting all properties.
function file4Struct3_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file4Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function file5Struct3_label_Callback(hObject, eventdata, handles)
% hObject    handle to file5Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of file5Struct3_label as text
%        str2double(get(hObject,'String')) returns contents of file5Struct3_label as a double


% --- Executes during object creation, after setting all properties.
function file5Struct3_label_CreateFcn(hObject, eventdata, handles)
% hObject    handle to file5Struct3_label (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end
