function varargout = combineuff_and_swapDOF(varargin) % COMBINEUFF_AND_SWAPDOF M-file for combineuff_and_swapDOF.fig % COMBINEUFF_AND_SWAPDOF, by itself, creates a new COMBINEUFF_AND_SWAPDOF or raises the existing % singleton*. % % H = COMBINEUFF_AND_SWAPDOF returns the handle to a new COMBINEUFF_AND_SWAPDOF or the handle to % the existing singleton*. % % COMBINEUFF_AND_SWAPDOF('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in COMBINEUFF_AND_SWAPDOF.M with the given input arguments. % % COMBINEUFF_AND_SWAPDOF('Property','Value',...) creates a new COMBINEUFF_AND_SWAPDOF or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before combineuff_and_swapDOF_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to combineuff_and_swapDOF_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help combineuff_and_swapDOF % Last Modified by GUIDE v2.5 18-Jul-2007 08:06:03 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @combineuff_and_swapDOF_OpeningFcn, ... 'gui_OutputFcn', @combineuff_and_swapDOF_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before combineuff_and_swapDOF is made visible. function combineuff_and_swapDOF_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to combineuff_and_swapDOF (see VARARGIN) % Choose default command line output for combineuff_and_swapDOF handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes combineuff_and_swapDOF wait for user response (see UIRESUME) % uiwait(handles.figure1); set(handles.end_button,'Visible','off'); % --- Outputs from this function are returned to the command line. function varargout = combineuff_and_swapDOF_OutputFcn(hObject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure varargout{1} = handles.output; function name_out_Callback(hObject, eventdata, handles) % hObject handle to name_out (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of name_out as text % str2double(get(hObject,'String')) returns contents of name_out as a double % --- Executes during object creation, after setting all properties. function name_out_CreateFcn(hObject, eventdata, handles) % hObject handle to name_out (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function num_files_Callback(hObject, eventdata, handles) % hObject handle to num_files (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of num_files as text % str2double(get(hObject,'String')) returns contents of num_files as a double % --- Executes during object creation, after setting all properties. function num_files_CreateFcn(hObject, eventdata, handles) % hObject handle to num_files (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in run. function run_Callback(hObject, eventdata, handles) % hObject handle to run (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.end_button,'Visible','off'); filename = get(handles.name_out,'string'); fid2 = fopen(filename, 'w'); numfiles = str2num(get(handles.num_files,'string')); for ifile = 1:numfiles [filename,pathname] = uigetfile('*.uff',['Select file number ',num2str(ifile)]); clear l* fid = fopen([pathname,filename], 'r'); i = 0; while 1 i = i+1; tline = fgetl(fid); if ~ischar(tline), break, end eval(['line' num2str(i) '= tline;']); if i == 8 temp = line8(48:55); line8(48:55)=line8(73:80); line8(73:80)=temp; end end fclose(fid); for j = 1:i-1 eval(['str= line' num2str(j) ';']); fprintf(fid2,'%s\n',str); end end fclose(fid2); set(handles.end_button,'Visible','on')