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