function varargout = foxli(varargin)
% FOXLI MATLAB code for foxli.fig
% FOXLI, by itself, creates a new FOXLI or raises the existing
% singleton*.
%
% H = FOXLI returns the handle to a new FOXLI or the handle to
% the existing singleton*.
%
% FOXLI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FOXLI.M with the given input arguments.
%
% FOXLI('Property','Value',...) creates a new FOXLI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before foxli_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to foxli_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 foxli
% Last Modified by GUIDE v2.5 13-Jun-2013 10:59:35
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @foxli_OpeningFcn, ...
'gui_OutputFcn', @foxli_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 foxli is made visible.
function foxli_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 foxli (see VARARGIN)
% Choose default command line output for foxli
handles.output = hObject;
setappdata(handles.figure1,'stop',0); %标志位初始化
setappdata(handles.figure1,'mode',0);
setappdata(handles.figure1,'shape',0);
setappdata(handles.figure1,'quit_mode',0); %模式1表示暂停时,或者工作时退出 模式2表示复位后退出
setappdata(handles.figure1,'work_mode',0);
set(handles.state,'String','未开始');
setappdata(handles.figure1,'name',0);
set(handles.activex2,'PortionPercent',0);
setappdata(handles.figure1,'name1',0);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes foxli wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = foxli_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 selection change in Shape.
function Shape_Callback(hObject, eventdata, handles)
% hObject handle to Shape (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns Shape contents as cell array
% contents{get(hObject,'Value')} returns selected item from Shape
shape_reg=get(hObject,'value');
switch shape_reg
case 1
setappdata(handles.figure1,'shape',1);
axes(handles.Shape_Show);
cla;
case 2
setappdata(handles.figure1,'shape',2);
axes(handles.Shape_Show);
photo1=imread('tiao.png');
imshow(photo1);
case 3
setappdata(handles.figure1,'shape',3);
axes(handles.Shape_Show);
photo1=imread('juxing.png');
imshow(photo1);
case 4
setappdata(handles.figure1,'shape',4);
axes(handles.Shape_Show);
photo1=imread('yuan.png');
imshow(photo1);
case 5
setappdata(handles.figure1,'shape',5);
axes(handles.Shape_Show);
photo1=imread('ao.png');
imshow(photo1);
case 6
setappdata(handles.figure1,'shape',6);
axes(handles.Shape_Show);
photo1=imread('xie.png');
imshow(photo1);
end
flash(handles);
function flash(handles) %隐藏所有不需要的控件
jud1=get(handles.Shape,'Value');
jud2=get(handles.R_mode,'Value');
jud3=get(handles.ini_dis,'Value');
if(jud3==1)
hideall(handles);
else
if(jud2==1)
hideall(handles);
elseif (jud2==2)
set(handles.text20,'Visible','off');
set(handles.jingdu,'Visible','off');
switch jud1
case 1
hideall(handles);
case 2
tiao_1(handles);
show_fren(handles);
case 3
fang_1(handles);
show_fren(handles);
case 4
yuan_1(handles);
show_fren(handles);
case 5
ao_1(handles);
show_fren(handles);
case 6
xie_1(handles);
show_fren(handles);
end
elseif(jud2==3)
set(handles.text20,'Visible','on');
set(handles.jingdu,'Visible','on');
switch jud1
case 1
hideall(handles);
case 2
tiao_1(handles);
show_fren(handles);
case 3
fang_1(handles);
show_fren(handles)
case 4
yuan_1(handles);
show_fren(handles)
case 5
ao_1(handles);
show_fren(handles)
case 6
xie_1(handles);
show_fren(handles)
end
end
end
function show_fren(handles)
Lamda1=str2num(get(handles.Lamda,'String'));
L1=str2num(get(handles.Length,'String'));
a1=str2num(get(handles.Wide_x,'String'));
frens=a1^2*10^6/(Lamda1*L1);
set(handles.text26,'String',strcat('菲涅尔数:',num2str(frens)));
function hideall(handles) %未选中工作模式时,关闭所有设置窗口
set(handles.R_times,'Visible','off');
set(handles.Lamda,'Visible','off');
set(handles.Length,'Visible','off');
set(handles.Wide_x,'Visible','off');
set(handles.Wide_y,'Visible','off');
set(handles.Start,'enable','off');
set(handles.Stop_Continue,'enable','off');
set(handles.Clearfig,'enable','off');
set(handles.Save,'enable','off');
set(handles.Sample,'Visible','off');
set(handles.jingdu,'Visible','off');
set(handles.text4,'Visible','off');
set(handles.text20,'Visible','off');
set(handles.text17,'Visible','off');
set(handles.text5,'Visible','off');
set(handles.text7,'Visible','off');
set(handles.text8,'Visible','off');
set(handles.text9,'Visible','off');
set(handles.text6,'Visible','off');
set(handles.text10,'Visible','off');
set(handles.text12,'Visible','off');
set(handles.text11,'Visible','off');
function tiao_1(handles) %条形腔
show_common(handles);
set(handles.text8,'String','腔镜半宽X:');
set(handles.text9,'String','腔镜半宽Y:');
set(handles.text9,'Visible','off');
set(handles.Wide_y,'Visible','off');
set(handles.text12,'Visible','off');
function fang_1(handles) %矩形腔
show_common(handles);
set(
评论1