Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function varargout = untitled2(varargin)
- % UNTITLED2 MATLAB code for untitled2.fig
- % UNTITLED2, by itself, creates a new UNTITLED2 or raises the existing
- % singleton*.
- %
- % H = UNTITLED2 returns the handle to a new UNTITLED2 or the handle to
- % the existing singleton*.
- %
- % UNTITLED2('CALLBACK',hObject,eventData,handles,...) calls the local
- % function named CALLBACK in UNTITLED2.M with the given input arguments.
- %
- % UNTITLED2('Property','Value',...) creates a new UNTITLED2 or raises the
- % existing singleton*. Starting from the left, property value pairs are
- % applied to the GUI before untitled2_OpeningFcn gets called. An
- % unrecognized property name or invalid value makes property application
- % stop. All inputs are passed to untitled2_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 untitled2
- % Last Modified by GUIDE v2.5 30-Sep-2012 21:52:34
- % Begin initialization code - DO NOT EDIT
- gui_Singleton = 1;
- gui_State = struct('gui_Name', mfilename, ...
- 'gui_Singleton', gui_Singleton, ...
- 'gui_OpeningFcn', @untitled2_OpeningFcn, ...
- 'gui_OutputFcn', @untitled2_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 untitled2 is made visible.
- function untitled2_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 untitled2 (see VARARGIN)
- axes(handles.Wereldkaart);
- % Plot de wereldkaart
- load('topo.mat','topo','topomap1');
- contour(0:359,-89:90,topo,[0 0],'b')
- % Wacht op de volgende plot
- hold on
- % Kleur de plot in
- image([0 360],[-90 90],topo,'CDataMapping', 'scaled');
- colormap(topomap1);
- % Maak de assen
- axis equal
- box on
- set(gca,'XLim',[0 360],'YLim',[-90 90], ...
- 'XTick',[0 60 120 180 240 300 360], ...
- 'Ytick',[-90 -60 -30 0 30 60 90]);
- %% Assen informatie
- title('Route geplot op de wereldkaart');
- xlabel('Longtitude (\circ)');
- ylabel('Latitude (\circ)');
- % Choose default command line output for untitled2
- handles.output = hObject;
- % Update handles structure
- % UIWAIT makes untitled2 wait for user response (see UIRESUME)
- % uiwait(handles.figure1);
- % --- Outputs from this function are returned to the command line.
- function varargout = untitled2_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;
- % --- Executes on button press in pushbutton1.
- function pushbutton1_Callback(hObject, eventdata, handles)
- [input.textnaam, input.textpad]=uigetfile('*.txt');
- input.pad=[input.textpad, input.textnaam];
- handles.current_text=input.pad;
- set(handles.edit_pad,'String',input.pad);
- % hObject handle to pushbutton1 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % --- Executes on button press in pushbutton2.
- function pushbutton2_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton2 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % --- Executes on button press in pushbutton3.
- function pushbutton3_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton3 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- Route = importdata('Route1.txt');
- lon=Route(:,1); %latitude coordinaten uit txt file halen
- lat=Route(:,2); %longitude coordinaten uit txt file halen
- for w=1:length(lon)
- if lon(w)<0
- lon(w)=lon(w)+360;
- end
- end
- plot(lon,lat,'red')
- axes(handles.Wereldkaart)
- hold on
- axes(handles.axes1);
- % Import data
- data=importdata('data_1.txt');
- data_1=data;
- % Make grid
- for i=1:360
- for j=1:180
- a=((i-1)*180)+j;
- data(a,2)=data(a,2)+90;
- end
- end
- for i=1:360
- for j=1:180
- a=((i-1)*180)+j;
- data_raw(i,j)=data(a,3);
- end
- end
- data_2=data_raw;
- % Plot data
- title('Raw Data')
- surf(data_raw);
- hold off
- % --- Executes on button press in pushbutton4.
- function pushbutton4_Callback(hObject, eventdata, handles)
- % hObject handle to pushbutton4 (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- % Clean NaN
- global data_raw;
- axes(handles.axes1)
- for i=2:360
- for j=2:180
- if isnan(data_raw(i,j))
- if j<2
- data_raw(i,j)=data_raw(i-1,j);
- end
- if j>1
- data_raw(i,j)=data_raw(i,j-1);
- end
- end
- end
- end
- %% Peaks and Valleys
- d=data_raw; %
- % Maximum deviation
- dev=0.05;
- % Clean data
- for i=1:360
- for j=1:180
- if i==1
- if j>2
- if (d(i,j)<d(i,j-2)*(1-dev))|(d(i,j)>d(i,j-2)*(1+dev))
- d(i,j)=2*d(i,j-1)-d(i,j-2);
- end
- end
- end
- if i==2
- if j>2
- if (d(i,j)<d(i,j-2)*(1-dev))|(d(i,j)>d(i,j-2)*(1+dev))
- d(i,j)=2*d(i,j-1)-d(i,j-2);
- end
- end
- end
- if i>2
- if j<3
- if (d(i,j)<d(i-2,j)*(1-dev))|(d(i,j)>d(i-2,j)*(1+dev))
- d(i,j)=(2*d(i-1,j))-d(i-2,j);
- end
- end
- if j>2
- if (d(i,j)<d(i-2,j)*(1-dev))|(d(i,j)>d(i-2,j)*(1+dev))
- d(i,j)=((2*d(i,j-1)-d(i,j-2))+(2*d(i-1,j)-d(i-2,j)))/2;
- end
- end
- end
- end
- end
- data_clean=d;
- % Plot data
- title('Clean Data')
- surf(data_clean);
- function edit_pad_Callback(hObject, eventdata, handles)
- % hObject handle to edit_pad (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 edit_pad as text
- % str2double(get(hObject,'String')) returns contents of edit_pad as a double
- % --- Executes during object creation, after setting all properties.
- function edit_pad_CreateFcn(hObject, eventdata, handles)
- % hObject handle to edit_pad (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 edit2_Callback(hObject, eventdata, handles)
- % hObject handle to edit2 (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 edit2 as text
- % str2double(get(hObject,'String')) returns contents of edit2 as a double
- % --- Executes during object creation, after setting all properties.
- function edit2_CreateFcn(hObject, eventdata, handles)
- % hObject handle to edit2 (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
Add Comment
Please, Sign In to add comment