function varargout = ColumnArrayInfo(varargin)
% COLUMNARRAYINFO Application M-file for ColumnArrayInfo.fig
% FIG = COLUMNARRAYINFO launch ColumnArrayInfo GUI.
% COLUMNARRAYINFO('callback_name', ...) invoke the named callback.
% Last Modified by GUIDE v2.0 29-Jul-2002 16:43:19
if nargin == 3 % LAUNCH GUI
fig = openfig(mfilename,'reuse');
% Use system color scheme for figure:
set(fig,'Color',get(0,'defaultUicontrolBackgroundColor'));
% Generate a structure of handles to pass to callbacks, and store it.
handles = guihandles(fig);
guidata(fig, handles);
pos_size=get(fig,'Position');
pos=varargin{3};
if length(pos) ~= 2
error('Input argument must be a 2-element vector')
end
new_pos = [pos(1) pos(2) pos_size(3) pos_size(4)];
set(fig, 'Position', new_pos,'Visible','on')
columnnumber=varargin{2};
switch columnnumber
case 7 , columnnumber='n-5';
case 8 , columnnumber='n-4';
case 9 , columnnumber='n-3';
case 10 , columnnumber='n-2';
case 11 , columnnumber='n-1';
case 12 , columnnumber='n';
end
set(handles.txtColumnNr,'String',columnnumber);
PoplsbTV=varargin{1};
m=length(PoplsbTV);
CLS_Array1=cell(1,m);
for i=1:m
CLS_Array1{1,i}=rats(PoplsbTV(i));
end
handles.CLSArray1=CLS_Array1;
handles.PoplsbTVArray=PoplsbTV;
guidata(fig, handles);
set(handles.lsbTotalValues,'String',CLS_Array1,'Value',m);
set(handles.txtTotalValues,'String',m);
PoplsbDV=refmults(varargin{1});
n=length(PoplsbDV);
CLS_Array2=cell(1,n);
for i=1:n
CLS_Array2{1,i}=rats(PoplsbDV(i));
end
handles.CLSArray2=CLS_Array2;
handles.PoplsbDVArray=PoplsbDV;
guidata(fig, handles);
set(handles.lsbDifferentValues,'String',CLS_Array2,'Value',1);
set(handles.txtDifferentValues,'String',n);
lsbDifferentValues_Callback(fig, [], guidata(fig));
if nargout > 0
varargout{1} = fig;
end
elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK
try
[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
catch
disp(lasterr);
end
end
%| ABOUT CALLBACKS:
%| GUIDE automatically appends subfunction prototypes to this file, and
%| sets objects' callback properties to call them through the FEVAL
%| switchyard above. This comment describes that mechanism.
%|
%| Each callback subfunction declaration has the following form:
%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)
%|
%| The subfunction name is composed using the object's Tag and the
%| callback type separated by '_', e.g. 'slider2_Callback',
%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.
%|
%| H is the callback object's handle (obtained using GCBO).
%|
%| EVENTDATA is empty, but reserved for future use.
%|
%| HANDLES is a structure containing handles of components in GUI using
%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This
%| structure is created at GUI startup using GUIHANDLES and stored in
%| the figure's application data using GUIDATA. A copy of the structure
%| is passed to each callback. You can store additional information in
%| this structure at GUI startup, and you can change the structure
%| during callbacks. Call guidata(h, handles) after changing your
%| copy to replace the stored original so that subsequent callbacks see
%| the updates. Type "help guihandles" and "help guidata" for more
%| information.
%|
%| VARARGIN contains any extra arguments you have passed to the
%| callback. Specify the extra arguments by editing the callback
%| property in the inspector. By default, GUIDE sets the property to:
%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))
%| Add any extra arguments after the last argument, before the final
%| closing parenthesis.
function A=refmults(B)
deiktisA=1;
A(deiktisA)=B(1);
for i=2:length(B)
%
vrethike=1;
voithdeiktis=0;
while vrethike==1 & voithdeiktis < deiktisA
voithdeiktis=voithdeiktis+1;
if abs(A(voithdeiktis)-B(i))<10^(-4)
vrethike=0;
end
end
% (vrethike=1),
if vrethike==1
deiktisA=deiktisA+1;
A(deiktisA)=B(i);
end
end
A=sort(A);
% --------------------------------------------------------------------
function varargout = lsbDifferentValues_Callback(h, eventdata, handles, varargin)
lsb_val=get(handles.lsbDifferentValues,'Value');
DV=handles.PoplsbDVArray;
TV=handles.PoplsbTVArray;
n=length(TV);
nrinstances=0;
for i=1:n
if abs(TV(i)-DV(lsb_val))<10^(-4)
nrinstances=nrinstances+1;
end
end
set(handles.txtNrOfInstances,'String',nrinstances);
percentapp=cur2str(100*nrinstances/n);
if percentapp(2)=='.'
percentapp(1)='0';
else
percentapp(1)='';
end
percentapp(length(percentapp)+1)='%';
set(handles.txtPerCentAppearance,'String',percentapp);
% --------------------------------------------------------------------
function varargout = lsbTotalValues_Callback(h, eventdata, handles, varargin)
% --------------------------------------------------------------------
function varargout = psbDone_Callback(h, eventdata, handles, varargin)
delete(handles.fgrColumnArrayInfo)
% --------------------------------------------------------------------
function varargout = ckbRatFracAppr_Callback(h, eventdata, handles, varargin)
i=get(handles.ckbRatFracAppr,'Value');
TV=handles.PoplsbTVArray;
DV=handles.PoplsbDVArray;
if i==1
m=length(TV);
if get(handles.ckbSortTotalValues,'Value')==1
TV=sortrows(TV);
end
CLS_Array1=cell(1,m);
for i=1:m
CLS_Array1{1,i}=rats(TV(i));
end
set(handles.lsbTotalValues,'String',CLS_Array1,'Value',m);
n=length(DV);
CLS_Array2=cell(1,n);
for i=1:n
CLS_Array2{1,i}=rats(DV(i));
end
set(handles.lsbDifferentValues,'String',CLS_Array2);
else
m=length(TV);
if get(handles.ckbSortTotalValues,'Value')==1
TV=sortrows(TV);
end
CLS_Array1=cell(1,m);
for i=1:m
CLS_Array1{1,i}=TV(i);
end
set(handles.lsbTotalValues,'String',CLS_Array1,'Value',m);
n=length(DV);
CLS_Array2=cell(1,n);
for i=1:n
CLS_Array2{1,i}=DV(i);
end
set(handles.lsbDifferentValues,'String',CLS_Array2);
end
% --------------------------------------------------------------------
function varargout = ckbSortTotalValues_Callback(h, eventdata, handles, varargin)
TV=handles.PoplsbTVArray;
i=get(handles.ckbSortTotalValues,'Value');
if i==1
m=length(TV);
CLS_Array1=cell(1,m);
TV=sortrows(TV);
for i=1:m
if get(handles.ckbRatFracAppr,'Value')==1
CLS_Array1{1,i}=rats(TV(i));
else
CLS_Array1{1,i}=TV(i);
end
end
set(handles.lsbTotalValues,'String',CLS_Array1,'Value',m);
else
m=length(TV);
CLS_Array1=cell(1,m);
for i=1:m
if get(handles.ckbRatFracAppr,'Value')==1
CLS_Array1{1,i}=rats(TV(i));
else
CLS_Array1{1,i}=TV(i);
end
end
set(handles.lsbTotalValues,'String',CLS_Array1,'Value',m);
end