0001 function varargout = Menu_Save_PCA(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 gui_Singleton = 1;
0012 gui_State = struct('gui_Name', mfilename, ...
0013 'gui_Singleton', gui_Singleton, ...
0014 'gui_OpeningFcn', @Menu_Save_Dades_OpeningFcn, ...
0015 'gui_OutputFcn', @Menu_Save_Dades_OutputFcn, ...
0016 'gui_LayoutFcn', [] , ...
0017 'gui_Callback', []);
0018 if nargin && ischar(varargin{1})
0019 gui_State.gui_Callback = str2func(varargin{1});
0020 end
0021
0022 if nargout
0023 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0024 else
0025 gui_mainfcn(gui_State, varargin{:});
0026 end
0027
0028 function Menu_Save_Dades_OpeningFcn(hObject, ~, handles, varargin)
0029
0030
0031
0032
0033 handles.output = hObject;
0034 guidata(hObject, handles);
0035
0036
0037 x=evalin('base','whos();');
0038 list=[];
0039 for i=1:length(x)
0040 if strcmp(x(i).class,'PCA') ~=0
0041 list=[list; {x(i).name}];
0042 end
0043 end
0044 if isempty(list)
0045 list={'No PCA object in workspace'};
0046 end
0047 set(handles.Variables,'String',list);
0048
0049 function Escollir_Callback(~, ~, handles)
0050
0051
0052
0053 [fitxer,ruta,~]=uiputfile('*.*');
0054
0055 if fitxer ~= 0
0056
0057
0058
0059 set(handles.Fitxer,'String',strcat(ruta,fitxer));
0060
0061 else
0062
0063 errordlg('No file selected','Error');
0064
0065 end
0066
0067 function Genera_Callback(~, ~, handles)
0068
0069
0070
0071 variable=get(handles.Variables,'String');
0072 variable=variable{get(handles.Variables,'Value')};
0073
0074
0075 fitxer=get(handles.Fitxer,'String');
0076
0077
0078 if isempty(fitxer)
0079
0080 errordlg('No file selected','Error');
0081
0082 else
0083
0084 format=get(handles.Format,'String');
0085
0086
0087 switch format{get(handles.Format,'Value')}
0088 case 'Weka'
0089 evalin('base',[ variable '.weka(''' fitxer ''');']);
0090 case 'MAT'
0091
0092 evalin('base',['save ' '' fitxer '' ' ' '' variable '']);
0093
0094 otherwise
0095 errordlg('Inexistent file format','Error');
0096 end
0097
0098
0099 close('Menu_Save_PCA');
0100 end
0101
0102 function Update(hObject, ~, handles)
0103 handles.output = hObject;
0104
0105
0106
0107
0108
0109 x=evalin('base','whos();');
0110 list=[];
0111 for i=1:length(x)
0112 if strcmp(x(i).class,'PCA') ~=0
0113 list=[list; {x(i).name}];
0114 end
0115 end
0116 if isempty(list)
0117 list={'No PCA object in workspace'};
0118 end
0119
0120
0121 nom=get(handles.Variables,'String');
0122 nom=nom{get(handles.Variables,'Value')};
0123
0124
0125 val=find(strcmp(nom,list));
0126 set(handles.Variables,'String',list);
0127
0128 if isempty(val)
0129
0130
0131 set(handles.Variables,'Value',1);
0132 else
0133
0134 set(handles.Variables,'Value',val);
0135 end
0136
0137 guidata(hObject, handles);
0138
0139
0140 function Variables_Callback(~, ~, ~)
0141 function Variables_CreateFcn(hObject, ~, ~)
0142 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0143 set(hObject,'BackgroundColor','white');
0144 end
0145 function Format_Callback(~, ~, ~)
0146 function Format_CreateFcn(hObject, ~, ~)
0147 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0148 set(hObject,'BackgroundColor','white');
0149 end
0150 function Fitxer_Callback(~, ~, ~)
0151 function varargout = Menu_Save_Dades_OutputFcn(~, ~, handles)
0152 varargout{1} = handles.output;
0153 function Fitxer_CreateFcn(hObject, ~, ~)
0154 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0155 set(hObject,'BackgroundColor','white');
0156 end