?? gui_mesh2d.asv
字號(hào):
function varargout = GUI_Mesh2d(varargin)
% GUI_MESH2D M-file for GUI_Mesh2d.fig
% GUI_MESH2D, by itself, creates a new GUI_MESH2D or raises the existing
% singleton*.
%
% H = GUI_MESH2D returns the handle to a new GUI_MESH2D or the handle to
% the existing singleton*.
%
% GUI_MESH2D('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI_MESH2D.M with the given input arguments.
%
% GUI_MESH2D('Property','Value',...) creates a new GUI_MESH2D or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before GUI_Mesh2d_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to GUI_Mesh2d_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 GUI_Mesh2d
% Last Modified by GUIDE v2.5 24-Oct-2007 21:26:27
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUI_Mesh2d_OpeningFcn, ...
'gui_OutputFcn', @GUI_Mesh2d_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 GUI_Mesh2d is made visible.
function GUI_Mesh2d_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 GUI_Mesh2d (see VARARGIN)
% Choose default command line output for GUI_Mesh2d
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes GUI_Mesh2d wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = GUI_Mesh2d_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 File_New_Callback(hObject, eventdata, handles)
% hObject handle to File_New (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function File_Open_Callback(hObject, eventdata, handles)
% hObject handle to File_Open (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function File_Import_Boundary_Callback(hObject, eventdata, handles)
%該函數(shù)用于導(dǎo)入王老師系統(tǒng)中的邊界條件,這個(gè)邊界用來生成計(jì)算網(wǎng)格
[filename, pathname] = uigetfile({'*.txt', '文本文件(*.txt)';'*.dat','文本文件(*.dat)';});
if(filename == 0)
return;
end
filename = [pathname filename];
%讀取其中的文件,并為每一段分配空間
fid=fopen(filename,'r');
fscanf(fid,'%s ',2);%先丟掉‘一般地形區(qū)域’ ‘。。。。地形’
n=fscanf(fid,'%d',1);%得到該局域的段數(shù)(由幾個(gè)子區(qū)域構(gòu)成)
node=[];%定義一個(gè)空的節(jié)點(diǎn)數(shù)組,該數(shù)組用來存儲(chǔ)所有節(jié)點(diǎn)的坐標(biāo)
connect=[];%各個(gè)點(diǎn)的連接關(guān)系
nn=1;nt=0;%nt表示現(xiàn)在這個(gè)線段再總結(jié)點(diǎn)node中開頭點(diǎn)的索引
pn=[];%每段的點(diǎn)數(shù)
while(~feof(fid) && nn<=n)
na=fscanf(fid,'%d',1);%獲得每一段的點(diǎn)數(shù)
connect=[connect;(nt+1:na-1+nt)',(nt+2:na+nt)']
np=(fscanf(fid,'%f %f',[2 na]))';
node=[node;np];
pn=[pn,na];
nn=nn+1;%這里表示高程點(diǎn)就不必要了,只讀取邊界線數(shù)據(jù)
nt=nt+na;
end
%在該圖形界面上繪制出邊界線
nn=0;
% --------------------------------------------------------------------
function File_Callback(hObject, eventdata, handles)
% hObject handle to File (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -