0001 function varargout = Menu_Talla(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010 gui_Singleton = 1;
0011 gui_State = struct('gui_Name', mfilename, ...
0012 'gui_Singleton', gui_Singleton, ...
0013 'gui_OpeningFcn', @Menu_Talla_OpeningFcn, ...
0014 'gui_OutputFcn', @Menu_Talla_OutputFcn, ...
0015 'gui_LayoutFcn', [] , ...
0016 'gui_Callback', []);
0017 if nargin && ischar(varargin{1})
0018 gui_State.gui_Callback = str2func(varargin{1});
0019 end
0020
0021 if nargout
0022 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0023 else
0024 gui_mainfcn(gui_State, varargin{:});
0025 end
0026
0027 function Menu_Talla_OpeningFcn(hObject, ~, handles, varargin)
0028
0029
0030
0031
0032
0033 handles.output = hObject;
0034 handles=menu(handles);
0035 guidata(hObject, handles);
0036
0037
0038 x=evalin('base','whos();');
0039 list=[];
0040 for i=1:length(x)
0041 if (strcmp(x(i).class,'CBR') ~=0 || strcmp(x(i).class,'PCA') ~=0 || strcmp(x(i).class,'DATA') ~=0 )
0042 list=[list; {x(i).name}];
0043 end
0044 end
0045 if isempty(list)
0046 list={'No objects in workspace'};
0047 end
0048
0049 set(handles.popupmenu1,'String',list);
0050
0051
0052 set(handles.uipanel1,'Visible','off');
0053 set(handles.uipanel2,'Visible','off');
0054 set(handles.uipanel4,'Visible','off');
0055 set(handles.axes1,'Visible','off');
0056
0057
0058 popupmenu1_Callback([],[], handles);
0059
0060 function checkbox1_Callback(hObject, ~, handles)
0061
0062 if ~get(hObject,'Value')
0063 set(handles.edit1,'enable','on');
0064 set(handles.edit2,'enable','on');
0065 else
0066 set(handles.edit1,'enable','off');
0067 set(handles.edit2,'enable','off');
0068 end
0069
0070 function popupmenu1_Callback(~, ~, handles)
0071
0072
0073 x=get(handles.popupmenu1,'string');
0074 if ~strcmp(x{get(handles.popupmenu1,'Value')},'No objects in workspace')
0075 set(handles.uipanel1,'Visible','on');
0076 set(handles.uipanel2,'Visible','on');
0077 set(handles.uipanel4,'Visible','on');
0078 set(handles.axes1,'Visible','on');
0079
0080 ruta = mfilename('fullpath');
0081 imatge = imread([fileparts(ruta) filesep 'Imatges' filesep 'Dades3D.jpg']);
0082
0083 axes(handles.axes1);
0084 image(imatge);
0085 axis off;
0086
0087
0088 dade=get(handles.popupmenu1,'String');
0089 dade=dade{get(handles.popupmenu1,'Value')};
0090
0091
0092 x=evalin('base',['whos(''' dade ''');']);
0093 if strcmp(x.class,'CBR')
0094 set(handles.edit1,'string',{'1'});
0095 set(handles.edit2,'string',{ num2str(evalin('base',[dade '.getCaseBase.getSampleCount()']))});
0096 set(handles.edit3,'string',{ ['[1:' num2str(evalin('base',[dade '.getCaseBase.getVariableCount()'])) ']'] });
0097 end
0098 if strcmp(x.class,'PCA')
0099 set(handles.edit1,'string',{'1'});
0100 set(handles.edit2,'string',{ num2str(evalin('base',[dade '.getSampleCount()']))});
0101 set(handles.edit3,'string',{ ['[1:' num2str(evalin('base',[dade '.getVariableCount()'])) ']'] });
0102 end
0103 if strcmp(x.class,'DATA')
0104 set(handles.edit1,'string',{'1'});
0105 set(handles.edit2,'string',{ num2str(evalin('base',[dade '.getSampleCount()']))});
0106 set(handles.edit3,'string',{ ['[1:' num2str(evalin('base',[dade '.getVariableCount()'])) ']'] });
0107 end
0108 end
0109
0110 function checkbox2_Callback(hObject, ~, handles)
0111
0112 if ~get(hObject,'Value')
0113 set(handles.edit3,'enable','on');
0114 else
0115 set(handles.edit3,'enable','off');
0116 end
0117
0118 function pushbutton1_Callback(~, ~, handles)
0119
0120 dade=get(handles.popupmenu1,'String');
0121 dade=dade{get(handles.popupmenu1,'Value')};
0122
0123
0124 if get(handles.checkbox1,'Value')
0125 x=evalin('base',['whos(''' dade ''');']);
0126 if strcmp(x.class,'CBR')
0127 temps =['[1:' num2str(evalin('base',[dade '.getCaseBase.getSampleCount()'])) ']'];
0128 else
0129 temps =['[1:' num2str(evalin('base',[dade '.getSampleCount()'])) ']'];
0130 end
0131 else
0132 temps = ['[' get(handles.edit1,'string') ':' get(handles.edit2,'string') ']'];
0133 temps = [temps{:}];
0134 end
0135
0136 if get(handles.checkbox2,'Value')
0137 vars =''':''';
0138 else
0139 vars =get(handles.edit3,'string');
0140 vars = [vars{:}];
0141 end
0142
0143
0144 nom=get(handles.edit4,'String');
0145
0146
0147 if ~isempty(evalin('base',['whos([''' nom '''])'] ))
0148 choice = questdlg('Selected name is used, do you want to overwride?', 'Atencio', 'Yes','No','No');
0149 switch choice
0150 case 'Yes'
0151
0152
0153 inst=[nom '=talla(' dade ',' vars ',' temps ');'];
0154 evalin('base',inst);
0155
0156 close('Menu_Talla');
0157 Update_Caller();
0158
0159 case 'No'
0160
0161 end
0162 else
0163
0164 inst=[nom '=talla(' dade ',' vars ',' temps ');'];
0165 evalin('base',inst);
0166
0167 close('Menu_Talla');
0168 Update_Caller();
0169 end
0170
0171
0172
0173 function popupmenu1_CreateFcn(hObject, ~, ~)
0174 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0175 set(hObject,'BackgroundColor','white');
0176 end
0177 function edit3_Callback(~, ~, ~)
0178 function edit3_CreateFcn(hObject, ~, ~)
0179 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0180 set(hObject,'BackgroundColor','white');
0181 end
0182 function edit1_Callback(~, ~, ~)
0183 function edit1_CreateFcn(hObject, ~, ~)
0184 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0185 set(hObject,'BackgroundColor','white');
0186 end
0187 function edit2_Callback(~, ~, ~)
0188 function edit2_CreateFcn(hObject, ~, ~)
0189 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0190 set(hObject,'BackgroundColor','white');
0191 end
0192 function edit4_Callback(~, ~, ~)
0193 function edit4_CreateFcn(hObject, ~, ~)
0194 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0195 set(hObject,'BackgroundColor','white');
0196 end
0197 function varargout = Menu_Talla_OutputFcn(~, ~, handles)
0198 varargout{1} = handles.output;