function varargout = mygui(varargin)
% MYGUI MATLAB code for mygui.fig
%      MYGUI, by itself, creates a new MYGUI or raises the existing
%      singleton*.
%
%      H = MYGUI returns the handle to a new MYGUI or the handle to
%      the existing singleton*.
%
%      MYGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MYGUI.M with the given input arguments.
%
%      MYGUI('Property','Value',...) creates a new MYGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before mygui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to mygui_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
% Edit the above text to modify the response to help mygui
% Last Modified by GUIDE v2.5 05-May-2014 16:36:50

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @mygui_OpeningFcn, ...
                   'gui_OutputFcn',  @mygui_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 mygui is made visible.
function mygui_OpeningFcn(hObject, ~, 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 mygui (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes mygui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%handles.text12 = 0;
global v6
v6 = {};


% --- Outputs from this function are returned to the command line.
function varargout = mygui_OutputFcn(~, ~, 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;



% гДЕЯЭ Ъ ГЮДЮЧ ОПНЯРН ЙМНОЙХ Х ХУ ЙНККАЩЙХ




function edit1_Callback(hObject, ~, handles)
% hObject    handle to edit1 (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 edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double
value1 = str2double(get(hObject, 'String'));
if isnan(value1)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.edit1 = value1;
guidata(hObject,handles)


function edit2_Callback(hObject, ~, handles)
% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double

value2 = str2double(get(hObject, 'String'));
if isnan(value2)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.edit2 = value2;
guidata(hObject,handles)



function edit3_Callback(hObject, ~, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double

value3 = str2double(get(hObject, 'String'));
if isnan(value3)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.edit3 = value3;
guidata(hObject,handles)



function edit4_Callback(hObject, ~, handles)
% hObject    handle to edit4 (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 edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double

value4 = str2double(get(hObject, 'String'));
if isnan(value4)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.edit4 = value4;
guidata(hObject,handles)



function edit5_Callback(hObject, ~, handles)
% hObject    handle to edit5 (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 edit5 as text
%        str2double(get(hObject,'String')) returns contents of edit5 as a double


value5 = str2double(get(hObject, 'String'));
if isnan(value5)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.edit5 = value5;
guidata(hObject,handles)


function edit6_Callback(hObject, ~, handles)
% hObject    handle to edit6 (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 edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double


value6 = str2double(get(hObject, 'String'));
if isnan(value6)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.edit6 = value6;
guidata(hObject,handles)



function edit7_Callback(hObject, ~, handles)
% hObject    handle to edit7 (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 edit7 as text
%        str2double(get(hObject,'String')) returns contents of edit7 as a double

value7 = str2double(get(hObject, 'String'));
if isnan(value7)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.edit7 = value7;
guidata(hObject,handles)




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




%щрю тсмйжхъ ЯНУПЮМЪЕР ОПЕДЬЕЯРБСЧЫСЧ ЙКЕРЙС Б ЛЮЯЯХБ, РЕЛ ЯЮЛШЛ ОНЙЮГШБЮЪ
%ХЯРНПХЧ ОЕПЕЛЕЫЕМХИ



% v1 = get(handles.result1, 'String');
% v1 = v1(1);
% handles.hist = [handles.hist, v1];
% set(handles.text12,'String',handles.hist);
% disp(handles.hist);

global v6 k

% v1 = get(handles.result1, 'String');
% disp(v1);
% v5 = v1(4);
% disp(v5);

v6 = [v6, k];
set(handles.text12, 'String', v6);


% --- Executes on button press in resetbutton.
function resetbutton_Callback(hObject, ~, handles)
% hObject    handle to resetbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
initialize_gui(gcbf, handles, true);


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




%щрю тсмйжхъ дю╗Р бнглнфмнярэ гюдюбюрэ йнкхвеярбн акхфюиьху яняедеи ДКЪ
%ЮКЦНПХРЛЮ K-NEAREST NEIGHBOUR






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

nofnn = str2double(get(hObject, 'String'));
if isnan(nofnn)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.nofnn = nofnn;
guidata(hObject,handles)


function initialize_gui(fig_handle, handles, isreset)
% If the metricdata field is present and the reset flag is false, it means
% we are we are just re-initializing a GUI by calling it from the cmd line
% while it is up. So, bail out as we dont want to reset the data.
% if isfield(handles, 'metricdata') && ~isreset
%     return;
% end

handles.metricdata.edit1 = 0;
handles.metricdata.edit2 = 0;
handles.metricdata.edit3 = 0;
handles.metricdata.edit4 = 0;
handles.metricdata.edit5 = 0;
handles.metricdata.edit6 = 0;
handles.metricdata.edit7 = 0;
handles.metricdata.nofnn = 0;
handles.metricdata.distance = 0;
handles.metricdata.result1 = 0;
handles.metricdata.fmedit1 = 0;
handles.metricdata.fmedit2 = 0;
handles.metricdata.fmedit3 = 0;
handles.metricdata.fmedit4 = 0;
handles.metricdata.fmedit5 = 0;
handles.metricdata.fmedit6 = 0;
handles.metricdata.fmedit7 = 0;
handles.metricdata.text12 = 0;
handles.metricdata.edit22 = 0;


set(handles.edit1, 'String', 0);
set(handles.edit2,  'String', 0);
set(handles.edit3,  'String', 0);
set(handles.edit4,  'String', 0);
set(handles.edit5,  'String', 0);
set(handles.edit6,  'String', 0);
set(handles.edit7,  'String', 0);
set(handles.nofnn,  'String', 0);
set(handles.distance, 'String', 0);
set(handles.result1, 'String', 0);
set(handles.actual, 'String', 0);
set(handles.fmedit1, 'String', 0);
set(handles.fmedit2, 'String', 0);
set(handles.fmedit3, 'String', 0);
set(handles.fmedit4, 'String', 0);
set(handles.fmedit5, 'String', 0);
set(handles.fmedit6, 'String', 0);
set(handles.fmedit7, 'String', 0);
set(handles.text12, 'String', 0);
set(handles.edit22, 'String', 0);


% Update handles structure

% Б ДБСУ UITABLE ЙЮЙ ПЮГ ЛНХ 2 ЙНЛМЮРШ, Б ЙНРНПШУ Ъ ОПНБНДХК ХГЛЕПЕМХЪ


guidata(handles.figure1, handles);
set (handles.uitable3,'Data', {1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15; 16 17 18; 19 20 21; 22 23 24; 25 26 27});
set (handles.uitable4,'Data', {28 29 30; 31 32 33; 34 35 36; 37 38 39; 40 41 42});


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

d1 = {1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15; 16 17 18; 19 20 21; 22 23 24; 25 26 27};
set(hObject,'Data',d1);
set(hObject,'ColumnWidth','auto');
set(hObject,'ColumnEditable',true);


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

d2 = {28 29 30; 31 32 33; 34 35 36; 37 38 39; 40 41 42};
set(hObject,'Data',d2);
set(hObject,'ColumnWidth','auto');
set(hObject,'ColumnEditable',true);


% --- Executes during object creation, after setting all properties.
function distance_CreateFcn(hObject, eventdata, handles)



% тсмйжхъ онйюгшбюер пюгмхжс он лндскч лефдс ясллни хглепеммшу гмювемхи х
% хгмювюкэмн гюдюммшу


% hObject    handle to distance (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 rb1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to rb1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes during object creation, after setting all properties.
function result1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to result1 (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
%v1 = get(handles.result1,'String');



% --- Executes during object creation, after setting all properties.
function nofnn_CreateFcn(hObject, ~, handles)
% hObject    handle to nofnn (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



% бяе EDIT - щрн йсдю мсфмн ббндхрэ гмювемхъ яхкш яхцмюкю (бпсвмсч)



% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, ~, handles)
% hObject    handle to edit7 (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 edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (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 edit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit5 (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 edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (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 fmedit1_Callback(hObject, eventdata, handles)
% hObject    handle to fmedit1 (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 fmedit1 as text
%        str2double(get(hObject,'String')) returns contents of fmedit1 as a double

fmval1 = str2double(get(hObject, 'String'));
if isnan(fmval1)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.fmedit1 = fmval1;
guidata(hObject,handles)


% --- Executes during object creation, after setting all properties.
function fmedit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fmedit1 (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 fmedit2_Callback(hObject, eventdata, handles)
% hObject    handle to fmedit2 (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 fmedit2 as text
%        str2double(get(hObject,'String')) returns contents of fmedit2 as a double

fmval2 = str2double(get(hObject, 'String'));
if isnan(fmval2)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.fmedit2 = fmval2;
guidata(hObject,handles)


% --- Executes during object creation, after setting all properties.
function fmedit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fmedit2 (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 fmedit3_Callback(hObject, eventdata, handles)
% hObject    handle to fmedit3 (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 fmedit3 as text
%        str2double(get(hObject,'String')) returns contents of fmedit3 as a double
fmval3 = str2double(get(hObject, 'String'));
if isnan(fmval3)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.fmedit3 = fmval3;
guidata(hObject,handles)



% --- Executes during object creation, after setting all properties.
function fmedit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fmedit3 (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 fmedit4_Callback(hObject, eventdata, handles)
% hObject    handle to fmedit4 (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 fmedit4 as text
%        str2double(get(hObject,'String')) returns contents of fmedit4 as a double
fmval4 = str2double(get(hObject, 'String'));
if isnan(fmval4)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.fmedit4 = fmval4;
guidata(hObject,handles)


% --- Executes during object creation, after setting all properties.
function fmedit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fmedit4 (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 fmedit5_Callback(hObject, eventdata, handles)
% hObject    handle to fmedit5 (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 fmedit5 as text
%        str2double(get(hObject,'String')) returns contents of fmedit5 as a double

fmval5 = str2double(get(hObject, 'String'));
if isnan(fmval5)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.fmedit5 = fmval5;
guidata(hObject,handles)


% --- Executes during object creation, after setting all properties.
function fmedit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fmedit5 (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 fmedit6_Callback(hObject, eventdata, handles)
% hObject    handle to fmedit6 (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 fmedit6 as text
%        str2double(get(hObject,'String')) returns contents of fmedit6 as a double

fmval6 = str2double(get(hObject, 'String'));
if isnan(fmval6)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.fmedit6 = fmval6;
guidata(hObject,handles)


% --- Executes during object creation, after setting all properties.
function fmedit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fmedit6 (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 fmedit7_Callback(hObject, eventdata, handles)
% hObject    handle to fmedit7 (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 fmedit7 as text
%        str2double(get(hObject,'String')) returns contents of fmedit7 as a double

fmval7 = str2double(get(hObject, 'String'));
if isnan(fmval7)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.fmedit7 = fmval7;
guidata(hObject,handles)


% --- Executes during object creation, after setting all properties.
function fmedit7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fmedit7 (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 when selected object is changed in group1.
function group1_SelectionChangeFcn(hObject, eventdata, handles)


% гдеяэ ядекюмн рюй:

%ЕЯКХ БШАПЮМН РНКЭЙН БЮИ-ТЮИ, РН РНКЭЙН ЩРХ ГМЮВЕМХЪ ЯВХРЮЧРЯЪ,
%ЯННРБЕРЯРБЕММН, ЕЯКХ ТЛ - РН РНКЭЙН ТЛ.



% hObject    handle to the selected object in group1 
% eventdata  structure with the following fields (see UIBUTTONGROUP)
%	EventName: string 'SelectionChanged' (read only)
%	OldValue: handle of the previously selected object or empty if none was selected
%	NewValue: handle of the currently selected object
% handles    structure with handles and user data (see GUIDATA)

handles = guidata (hObject);
%if (hObject == handles.rb1)
switch get (eventdata.NewValue,'Tag')
    case 'rb1'

%----------------BEGINNING OF FM CALCULATION-------------------------

Sample = [handles.metricdata.fmedit1;
          handles.metricdata.fmedit2;
          handles.metricdata.fmedit3;
          handles.metricdata.fmedit4;
          handles.metricdata.fmedit5;
          handles.metricdata.fmedit6;
          handles.metricdata.fmedit7;
          ];

%  щрн рюй мюгшбюелши рпеимхмц-яер, я гюпюмее хглепеммшлх дюммшлх яхкш
%  яхцмюкю, нрдекэмн ДКЪ 7 РНВЕЙ ДНЯРСОЮ БЮИ-ТЮИ Х 7 ТЛ-ЯРЮМЖХЪЛХ


      
Training = [44 12 53 29 36 30 49; %a1 k305
            30 29 34 18 26 30 29; %b1 k305
            39 39 52 24 39 36 39; %c1 k305
            51 45 57 30 52 32 47;
            59 53 55 30 51 31 18;
            54 36 58 30 38 24 37; %c2
            52 44 29 33 38 37 37; %a3 k305
            22 30 29 30 33 38 31; %8 = B3
            54 35 52 33 27 24 34; %c3
            52 40 43 51 40 51 43; %a4
            54 39 55 38 52 44 37;
            54 48 30 53 54 38 29;   %12 = C4 in K305
            35 30 52 30 37 39 35;
            31 36 52 30 36 30 37; %b5
            52 30 50 30 38 30 34;
            59 36 67 54 47 30 39;  %a6 = 16
            38 40 56 36 52 40 39;
            58 39 39 54 51 54 45;
            30 39 58 54 52 41 38; %a7
            48 31 53 54 53 47 45;  %b7 = 20
            35 33 38 45 30 22 43;
            30 22 57 49 37 24 34;
            48 33 55 31 35 38 29;
            54 22 58 38 26 39 38; %c8 = 24
            52 22 70 29 30 28 30;
            58 32 60 44 54 37 32;
            47 33 58 28 28 24 30;
            %end of K305
            29 33 40 29 47 33 28; %A1 = 28
            53 44 58 21 53 26 25;
            45 44 55 11 39 39 43;
            36 51 35 30 53 28 33;
            36 34 39 24 38 39 37; %B2 = 32
            30 29 52 27 36 38 28;
            57 34 46 50 50 38 37; %a3
            35 40 37 28 39 35 39;
            44 37 57 30 39 30 51;
            56 57 64 49 44 40 26;  %A4 = 37
            39 30 37 31 38 31 29;
            60 54 36 29 49 51 51;
            43 43 57 39 52 52 53;
            57 56 40 30 36 44 39;
            39 37 59 36 51 42 34   %C5 = 42           
            ]';

[Class,~,distances] = nearestneighbour (Sample, Training, 'NumberOfNeighbours', 42);


%displayed result1 related to chosen N of NN
nofnn = handles.metricdata.nofnn;
set(handles.result1, 'String', Class(1:nofnn));

% дюкее йкюяя щрн акхфюиьхи яняед (мнлеп йкерйх б рюакхже)


dist = distances (Class);
set (handles.distance, 'String', round(sqrt(dist(1:nofnn))));

figure (2);
hold on
h1 = cdfplot(sqrt(dist));
set(h1,'Color','r');


d1 = {1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15; 16 17 18; 19 20 21; 22 23 24; 25 26 27};
d2 = {28 29 30; 31 32 33; 34 35 36; 37 38 39; 40 41 42};



% for i=2:nofnn
% Class(i) = Class(i) + Class(i-1) ;
% end;

global k
k = Class(1);

e1 = Training(1:end,handles.metricdata.actual);
e2 = Training(1:end, k);
ep = round(sqrt(sum((e1 - e2).^2)));
set(handles.edit22, 'String', ep);

%set(handles.distance, 'String', round(sqrt(dist)));

%% щрю опнжедспю опнярн бшдекъер йпюямшл рбн╗ леярнонкнфемхе



  %------------------------CELL HIGHLIGHT ROUTINE-------------------   
switch k
    case {1,2,3}
        d1(1,k)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {4,5,6}
        d1(2,k-3)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {7,8,9}
        d1(3,k-6)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {10,11,12}
        d1(4,k-9)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {13,14,15}
        d1(5,k-12)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {16,17,18}
        d1(6,k-15)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {19,20,21}
        d1(7,k-18)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {22,23,24}
        d1(8,k-21)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {25,26,27}
        d1(9,k-24)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {28,29,30}
        d2(1,k-27)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {31,32,33}
        d2(2,k-30)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {34,35,36}
        d2(3,k-33)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {37,38,39}
        d2(4,k-36)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {40,41,42}
        d2(5,k-39)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
end;

set (handles.uitable3,'Data', d1);
set (handles.uitable4,'Data', d2);


%-------------END OF FM CALCULATION------------------------


    case 'rb2'
        
%-------------BEGINNING OF WIFI CALCULATION----------------------

Sample = [handles.metricdata.edit1;
          handles.metricdata.edit2;
          handles.metricdata.edit3;
          handles.metricdata.edit4;
          handles.metricdata.edit5;
          handles.metricdata.edit6;
          handles.metricdata.edit7;
          ];

Training = [45 62 66.5 73 72 72 77.5; %A1 K 305
            45 59.5 68.5 74 79.5 73 78; %B1 K 305
            45 64 71.5 78.5 90 82 80; %c1 k 305
            45 65.5 71.5 70 77 77.5 74; %A2 k305
            45 64 65 73 77.5 67 77.5; %b2 k305
            45 60 71 72 73 78 78;
            45 63 64 74 76 73 73;
            45 66 66 72 82 73 82; %8
            46 65 67 78 82 83 80;
            47 66.5 64 73 78 74 77.5;
            45 66 68 74 73 72 78;
            49 66.5 66.5 73 82 75 76;   %12 = C4 in K305
            46 68.5 61.5 73.5 82 72.5 74;
            46 65.5 66.5 76 73 74.5 78;
            49 67 67 82 82 73 78;
            45 72.5 59 73 73 73 79;  %a6 = 16
            50.8 67 68.28 77.5 72 74 87;
            50 68.5 65 78.5 73 73 78;
            58 72.5 66 72.5 73 74 95;
            49 72.5 58 72 91 67 74;  %b7 = 20
            47 73 66 77.5 73 80 91;
            46 73 62.5 73.5 78 72 74;
            49 72 64 72 82 73 82;
            53.5 73 62.5 73 77.5 73 91; %c8 = 24
            47 73 65.5 73 87 72 91;
            51.25 74 67 73 87 71 91;
            47 82 66 73.5 86.5 78 74;
            %end of K305
            64.5 59.5 47.6 72 82 72 78; %A1 = 28
            67 60 45 77.5 95 73.5 78;
            58 59 45 67 78 78 88;
            68.5 64 45 68 80 73.5 91;
            59.5 58 45 73 87 89 79; %B2 = 32
            62 59 45 70 100 87 80;
            68.75 65 46 69 87 75 79;
            62 60 50 74 100 82 78;
            65.5 65 51.5 72 91 80 76;
            66 62.5 49 69 100 91.5 78;  %A4 = 37
            59.5 58 47 78 78 89 82;
            59.375 65.5 50 69 76 87 91;
            67.25 65 55 69.5 100 76 76;
            65 69.25 73 71.5 91 100 91;
            65 65.5 49 72.5 91 91 100   %5C = 42           
            ]';

[Class,~,distances] = nearestneighbour (Sample, Training, 'NumberOfNeighbours', 42);


%displayed result1 related to chosen N of NN
nofnn = handles.metricdata.nofnn;
set(handles.result1, 'String', Class(1:nofnn));


dist = distances (Class);
set (handles.distance, 'String', round(sqrt(dist(1:nofnn))));
figure (2);
h2 = cdfplot(sqrt(dist));
set(h2,'Color','g');


d1 = {1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15; 16 17 18; 19 20 21; 22 23 24; 25 26 27};
d2 = {28 29 30; 31 32 33; 34 35 36; 37 38 39; 40 41 42};


global k
k = Class(1);


e1 = Training(1:end,handles.metricdata.actual);
e2 = Training(1:end, k);
ep = round(sqrt(sum((e1 - e2).^2)));

set(handles.edit22, 'String', ep);


%-------------------CELL HIGHLIGHT ROUTINE------------------

switch k
    case {1,2,3}
        d1(1,k)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {4,5,6}
        d1(2,k-3)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {7,8,9}
        d1(3,k-6)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {10,11,12}
        d1(4,k-9)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {13,14,15}
        d1(5,k-12)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {16,17,18}
        d1(6,k-15)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {19,20,21}
        d1(7,k-18)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {22,23,24}
        d1(8,k-21)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {25,26,27}
        d1(9,k-24)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {28,29,30}
        d2(1,k-27)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {31,32,33}
        d2(2,k-30)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {34,35,36}
        d2(3,k-33)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {37,38,39}
        d2(4,k-36)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {40,41,42}
        d2(5,k-39)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
end;

set (handles.uitable3,'Data', d1);
set (handles.uitable4,'Data', d2);


%----------------END OF WIFI CALCULATION--------------------------
        
        
    case 'rb3'
        
        
%------------------BEGINNING OF FUSION CALCULATION--------------------



%%%% гдеяэ явхрючряъ наю бюпхюмрю - х бюитюи х тл, мн опх щрнл опнакелю б
%%%% рнл, врн дхярюмжхъ сбекхвхбюеряъ х рнвмнярэ оюдюер, мн ме
%%%% сбекхвхбюеряъ (((



Sample = [handles.metricdata.edit1;
          handles.metricdata.edit2;
          handles.metricdata.edit3;
          handles.metricdata.edit4;
          handles.metricdata.edit5;
          handles.metricdata.edit6;
          handles.metricdata.edit7;
          handles.metricdata.fmedit1;
          handles.metricdata.fmedit2;
          handles.metricdata.fmedit3;
          handles.metricdata.fmedit4;
          handles.metricdata.fmedit5;
          handles.metricdata.fmedit6;
          handles.metricdata.fmedit7;
          ];
      
Training1 = [45 62 66.5 73 72 72 77.5; %A1 K 305
            45 59.5 68.5 74 79.5 73 78; %B1 K 305
            45 64 71.5 78.5 90 82 80; %c1 k 305
            45 65.5 71.5 70 77 77.5 74; %A2 k305
            45 64 65 73 77.5 67 77.5; %b2 k305
            45 60 71 72 73 78 78;
            45 63 64 74 76 73 73;
            45 66 66 72 82 73 82; %8
            46 65 67 78 82 83 80;
            47 66.5 64 73 78 74 77.5;
            45 66 68 74 73 72 78;
            49 66.5 66.5 73 82 75 76;   %12 = C4 in K305
            46 68.5 61.5 73.5 82 72.5 74;
            46 65.5 66.5 76 73 74.5 78;
            49 67 67 82 82 73 78;
            45 72.5 59 73 73 73 79;  %a6 = 16
            50.8 67 68.28 77.5 72 74 87;
            50 68.5 65 78.5 73 73 78;
            58 72.5 66 72.5 73 74 95;
            49 72.5 58 72 91 67 74;  %b7 = 20
            47 73 66 77.5 73 80 91;
            46 73 62.5 73.5 78 72 74;
            49 72 64 72 82 73 82;
            53.5 73 62.5 73 77.5 73 91; %c8 = 24
            47 73 65.5 73 87 72 91;
            51.25 74 67 73 87 71 91;
            47 82 66 73.5 86.5 78 74;
            %end of K305
            64.5 59.5 47.6 72 82 72 78; %A1 = 28
            67 60 45 77.5 95 73.5 78;
            58 59 45 67 78 78 88;
            68.5 64 45 68 80 73.5 91;
            59.5 58 45 73 87 89 79; %B2 = 32
            62 59 45 70 100 87 80;
            68.75 65 46 69 87 75 79;
            62 60 50 74 100 82 78;
            65.5 65 51.5 72 91 80 76;
            66 62.5 49 69 100 91.5 78;  %A4 = 37
            59.5 58 47 78 78 89 82;
            59.375 65.5 50 69 76 87 91;
            67.25 65 55 69.5 100 76 76;
            65 69.25 73 71.5 91 100 91;
            65 65.5 49 72.5 91 91 100   %5C = 42           
            ]';

        
fmTraining = [44 12 53 29 36 30 49; %a1 k305
            30 29 34 18 26 30 29; %b1 k305
            39 39 52 24 39 36 39; %c1 k305
            51 45 57 30 52 32 47;
            59 53 55 30 51 31 18;
            54 36 58 30 38 24 37; %c2
            52 44 29 33 38 37 37; %a3 k305
            22 30 29 30 33 38 31; %8 = B3
            54 35 52 33 27 24 34; %c3
            52 40 43 51 40 51 43; %a4
            54 39 55 38 52 44 37;
            54 48 30 53 54 38 29;   %12 = C4 in K305
            35 30 52 30 37 39 35;
            31 36 52 30 36 30 37; %b5
            52 30 50 30 38 30 34;
            59 36 67 54 47 30 39;  %a6 = 16
            38 40 56 36 52 40 39;
            58 39 39 54 51 54 45;
            30 39 58 54 52 41 38; %a7
            48 31 53 54 53 47 45;  %b7 = 20
            35 33 38 45 30 22 43;
            30 22 57 49 37 24 34;
            48 33 55 31 35 38 29;
            54 22 58 38 26 39 38; %c8 = 24
            52 22 70 29 30 28 30;
            58 32 60 44 54 37 32;
            47 33 58 28 28 24 30;
            %end of K305
            29 33 40 29 47 33 28; %A1 = 28
            53 44 58 21 53 26 25;
            45 44 55 11 39 39 43;
            36 51 35 30 53 28 33;
            36 34 39 24 38 39 37; %B2 = 32
            30 29 52 27 36 38 28;
            57 34 46 50 50 38 37; %a3
            35 40 37 28 39 35 39;
            44 37 57 30 39 30 51;
            56 57 64 49 44 40 26;  %A4 = 37
            39 30 37 31 38 31 29;
            60 54 36 29 49 51 51;
            43 43 57 39 52 52 53;
            57 56 40 30 36 44 39;
            39 37 59 36 51 42 34   %C5 = 42           
            ]';
        
Training = vertcat(Training1, fmTraining);

[Class,~,distances] = nearestneighbour (Sample, Training, 'NumberOfNeighbours',42);
set(handles.result1, 'String', Class);


%displayed result1 related to chosen N of NN
nofnn = handles.metricdata.nofnn;

set(handles.result1, 'String', Class(1:nofnn));


dist = distances (Class);
figure (2);
h3 = cdfplot(sqrt(dist));
set(h3,'Color','y');
hold off


d1 = {1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15; 16 17 18; 19 20 21; 22 23 24; 25 26 27};
d2 = {28 29 30; 31 32 33; 34 35 36; 37 38 39; 40 41 42};



%% гдеяэ опнярн аепс япедмее юпхтлерхвеяйне врнаш нопедекхрэ мнлеп ъвеийх всрэ рнвмее


%-------CALCULATION OF AVERAGE CELL NUMBER -------------
global k

if nofnn == 1
    k = Class(1);
else
    for i=1:nofnn
        Class(i) = Class(i) + Class(i+1);
    end;
k = round(Class(i)/nofnn);
set(handles.result1, 'String', k);
end;

e1 = Training(1:end,handles.metricdata.actual);
e2 = Training(1:end, k);
ep = round(sqrt(sum((e1 - e2).^2)));
set(handles.edit22, 'String', ep);


%-------------------CELL HIGHLIGHT ROUTINE----------------------

switch k
    case {1,2,3}
        d1(1,k)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {4,5,6}
        d1(2,k-3)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {7,8,9}
        d1(3,k-6)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {10,11,12}
        d1(4,k-9)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {13,14,15}
        d1(5,k-12)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {16,17,18}
        d1(6,k-15)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {19,20,21}
        d1(7,k-18)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {22,23,24}
        d1(8,k-21)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {25,26,27}
        d1(9,k-24)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {28,29,30}
        d2(1,k-27)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {31,32,33}
        d2(2,k-30)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {34,35,36}
        d2(3,k-33)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {37,38,39}
        d2(4,k-36)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
    case {40,41,42}
        d2(5,k-39)=cellstr('<HTML><FONT color="red">you are here</Font></html>');
end;

set (handles.uitable3,'Data', d1);
set (handles.uitable4,'Data', d2);

end

%----------------END OF FUSION CALCULATION-----------------------



% --- Executes on key press with focus on rb1 and none of its controls.
function rb2_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to rb1 (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on key press with focus on rb1 and none of its controls.
function rb1_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to rb1 (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)


% --- Executes during object creation, after setting all properties.
function text12_CreateFcn(hObject, eventdata, handles)
% hObject    handle to text12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called
%handles.text12 = hObject;
%set(handles.text12, 'String', 0);
%guidata (hObject, handles);


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


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


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



function actual_Callback(hObject, eventdata, handles)
% hObject    handle to actual (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 actual as text
%        str2double(get(hObject,'String')) returns contents of actual as a double
actpos = str2double(get(hObject, 'String'));
if isnan(actpos)
    set(hObject, 'String', 0);
    errordlg('Input must be a number','Error');
end

% Save the new value
handles.metricdata.actual = actpos;
guidata(hObject,handles);


% --- Executes during object creation, after setting all properties.
function actual_CreateFcn(hObject, eventdata, handles)
% hObject    handle to actual (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 edit22_Callback(hObject, eventdata, handles)
% hObject    handle to edit22 (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 edit22 as text
%        str2double(get(hObject,'String')) returns contents of edit22 as a double


% --- Executes during object creation, after setting all properties.
function edit22_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit22 (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
