📄 madlab.m
字号:
%MADLAB: This GUI works as follows >>>
% <1> Gets the list of all File-exchange authors namewise.
% <2> Gets the author's info i.e. Rank, Downloads, No. of files,
% Latitude and longitude(if exists) and dispays these info inside respected
% frames in the GUI. It also displays the display picture of
% the author in GUI.
% <3> Displays the location of the author in world map and zooms into that
% location in right hand bottom corner of the world map.
%
% NOTE: You must be connected to internet to use this GUI.
function varargout = madlab(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @madlab_OpeningFcn, ...
'gui_OutputFcn', @madlab_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 madlab is made visible.
function madlab_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for madlab
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes madlab wait for user response (see UIRESUME)
% uiwait(handles.figure1);
img_map=imread('world_map.jpg');
axes(handles.axes1)
imshow(img_map)
% --- Outputs from this function are returned to the command line.
function varargout = madlab_OutputFcn(hObject, eventdata, handles)
% Get default command line output from handles structure
varargout{1} = handles.output;
%--------------------------------------------------------------------------% --- Executes during object creation, after setting all properties.function popupmenu1_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)
author_no_listwise=get(hObject,'Value');
handles.author_no_listwise=author_no_listwise;
guidata(hObject, handles);
set(handles.location_text,'String','-----')
set(handles.rank_text,'String','-----')
set(handles.downloads_text,'String','-----')
set(handles.files_text,'String','-----')
img=imread('no_pic.jpg');
axes(handles.axes2)
imshow(img)
img_map=imread('world_map.jpg');
axes(handles.axes1)
imshow(img_map)
% --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)
set(handles.status_text,'String','Loading..(may take 2-3 mins)')
a=get_author_names;
author_names=a(:,1);
handles.file_names = author_names;
set(handles.popupmenu1,'String',handles.file_names,'Value',1)
set(handles.status_text,'String','Loaded(Select any author)')
handles.author_num_list=a(:,2);
guidata(hObject, handles);% --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)author_no_listwise=handles.author_no_listwise;
author_num_list=handles.author_num_list;
[image_link,location,rank,downloads,files]=author_details(char(author_num_list(author_no_listwise)));
set(handles.location_text,'String',location)
set(handles.rank_text,'String',rank)
set(handles.downloads_text,'String',downloads)
set(handles.files_text,'String',files)
img=imread(image_link);
axes(handles.axes2)
imshow(img)
handles.location=location;
guidata(hObject, handles);
img_map=imread('world_map.jpg');
axes(handles.axes1)
imshow(img_map)
% --- Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)location=handles.location;
loc=char(location);
[lat,lon]=char_2_num(loc);
img=imread('world_map.jpg');
m=377;n=600;
m1=6+round(m/180*(90-lat));
n1=6+round(n/360*(180+lon));
box=[m1-4,n1-4;m1-3,n1-4;m1-2,n1-4;m1-1,n1-4;m1,n1-4;m1+1,n1-4;m1+2,n1-4;m1+3,n1-4;m1+4,n1-4;
m1-4,n1-3;m1+4,n1-3;m1-4,n1-2;m1+4,n1-2;m1-4,n1-1;m1+4,n1-1;m1-4,n1;m1+4,n1;
m1-4,n1+1;m1+4,n1+1;m1-4,n1+2;m1+4,n1+2;m1-4,n1+3;m1+4,n1+3;
m1-4,n1+4;m1-3,n1+4;m1-2,n1+4;m1-1,n1+4;m1,n1+4;m1+1,n1+4;m1+2,n1+4;m1+3,n1+4;m1+4,n1+4;
m1-2,n1-2;m1-1,n1-2;m1,n1-2;m1+1,n1-2;m1+2,n1-2;
m1-2,n1-1;m1+2,n1-1;
m1-2,n1;m1,n1;m1+2,n1;
m1-2,n1+1;m1+2,n1+1;
m1-2,n1+2;m1-1,n1+2;m1,n1+2;m1+1,n1+2;m1+2,n1+2];
[box_m,box_n]=size(box);
for i=1:box_m
img(box(i,1),box(i,2),:)=0;
end
limit_m_1=m1-40;
limit_m_2=m1+40;
limit_n_1=n1-60;
limit_n_2=n1+60;
if (m1-40<0)
limit_m_1=1;
end
if (m1+40>389)
limit_m_2=389;
end
if (n1-60<0)
limit_n_1=1;
end
if (n1+60>612)
limit_n_2=612;
end
img2=[];
for i=limit_m_1:limit_m_2
for j=limit_n_1:limit_n_2
img2(i-limit_m_1+1,j-limit_n_1+1,:)=img(i,j,:);
end
end
img=uint8(img);
img2=uint8(img2);
axes(handles.axes1)
imshow(img)
axes(handles.axes3)
imshow(img2)
% --- Executes when figure1 window is resized.function figure1_ResizeFcn(hObject, eventdata, handles)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -