0001 function varargout = Menu_Save_Dades(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,'DATA') ~=0
0038 list=[list; {x(i).name}];
0039 end
0040 end
0041 if isempty(list)
0042 list={'No DATA object in workspace'};
0043 end
0044 set(handles.Variables,'String',list);
0045
0046 function Escollir_Callback(~, ~, handles)
0047
0048
0049
0050 [fitxer,ruta,~]=uiputfile('*.*');
0051
0052 if fitxer ~= 0
0053
0054
0055
0056 set(handles.Fitxer,'String',strcat(ruta,fitxer));
0057
0058 else
0059
0060 errordlg('No file selected','Error');
0061
0062 end
0063
0064 function Genera_Callback(~, ~, handles)
0065
0066
0067
0068 variable=get(handles.Variables,'String');
0069 variable=variable{get(handles.Variables,'Value')};
0070
0071
0072 fitxer=get(handles.Fitxer,'String');
0073
0074
0075 if isempty(fitxer)
0076
0077 errordlg('No file selected','Error');
0078
0079 else
0080
0081 format=get(handles.Format,'String');
0082 format=format{get(handles.Format,'Value')};
0083
0084
0085 evalin('base',[ variable '.save(''' fitxer ''',''' format ''');']);
0086
0087
0088 close('Menu_Save_Dades');
0089 end
0090
0091 function Update(hObject, ~, handles)
0092 handles.output = hObject;
0093
0094
0095
0096
0097
0098 x=evalin('base','whos();');
0099 list=[];
0100 for i=1:length(x)
0101 if strcmp(x(i).class,'DATA') ~=0
0102 list=[list; {x(i).name}];
0103 end
0104 end
0105 if isempty(list)
0106 list={'No DATA object in workspace'};
0107 end
0108
0109
0110 nom=get(handles.Variables,'String');
0111 nom=nom{get(handles.Variables,'Value')};
0112
0113
0114 val=find(strcmp(nom,list));
0115 set(handles.Variables,'String',list);
0116
0117 if isempty(val)
0118
0119
0120 set(handles.Variables,'Value',1);
0121 else
0122
0123 set(handles.Variables,'Value',val);
0124 end
0125
0126 guidata(hObject, handles);
0127
0128
0129 function Variables_Callback(~, ~, ~)
0130 function Variables_CreateFcn(hObject, ~, ~)
0131 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0132 set(hObject,'BackgroundColor','white');
0133 end
0134 function Format_Callback(~, ~, ~)
0135 function Format_CreateFcn(hObject, ~, ~)
0136 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0137 set(hObject,'BackgroundColor','white');
0138 end
0139 function Fitxer_Callback(~, ~, ~)
0140 function varargout = Menu_Save_Dades_OutputFcn(~, ~, handles)
0141 varargout{1} = handles.output;
0142 function Fitxer_CreateFcn(hObject, ~, ~)
0143 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0144 set(hObject,'BackgroundColor','white');
0145 end