function varargout = draw_lens(varargin)
% DRAW_LENS MATLAB code for draw_lens.fig
% DRAW_LENS, by itself, creates a new DRAW_LENS or raises the existing
% singleton*.
%
% H = DRAW_LENS returns the handle to a new DRAW_LENS or the handle to
% the existing singleton*.
%
% DRAW_LENS('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DRAW_LENS.M with the given input arguments.
%
% DRAW_LENS('Property','Value',...) creates a new DRAW_LENS or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before draw_lens_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to draw_lens_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 draw_lens
% Last Modified by GUIDE v2.5 21-Jan-2015 16:47:47
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @draw_lens_OpeningFcn, ...
'gui_OutputFcn', @draw_lens_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 draw_lens is made visible.
function draw_lens_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 draw_lens (see VARARGIN)
%窗口居中显示
movegui(handles.figure1,'center');
% Choose default command line output for draw_lens
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
data.obj=1;
data.M=6;
setappdata(hObject, 'Data', data);
guidata(hObject,handles);
% UIWAIT makes draw_lens wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = draw_lens_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 O1_Callback(hObject, eventdata, handles)
% hObject handle to O1 (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 O1 as text
% str2double(get(hObject,'String')) returns contents of O1 as a double
guidata(hObject,handles);
data=getappdata(gcbf,'Data');
set(handles.O1,'Enable','on');
data.O1=str2double(get(handles.O1,'string'));
set(handles.O1,'string',num2str(data.O));
guidata(hObject,handles);
setappdata(gcbf,'Data',data);
OK_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function O1_CreateFcn(hObject, eventdata, handles)
% hObject handle to O1 (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 r1_Callback(hObject, eventdata, handles)
% hObject handle to r1 (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 r1 as text
% str2double(get(hObject,'String')) returns contents of r1 as a double
guidata(hObject,handles);
data=getappdata(gcbf,'Data');
set(handles.r1,'Enable','on');
data.r1=str2double(get(handles.r1,'string'));
set(handles.r1,'string',num2str(data.r));
guidata(hObject,handles);
setappdata(gcbf,'Data',data);
OK_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function r1_CreateFcn(hObject, eventdata, handles)
% hObject handle to r1 (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 D_Callback(hObject, eventdata, handles)
% hObject handle to D (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 D as text
% str2double(get(hObject,'String')) returns contents of D as a double
guidata(hObject,handles);
data=getappdata(gcbf,'Data');
set(handles.D,'Enable','on');
data.D=str2double(get(handles.D,'string'));
set(handles.D,'string',num2str(data.D));
guidata(hObject,handles);
setappdata(gcbf,'Data',data);
OK_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function D_CreateFcn(hObject, eventdata, handles)
% hObject handle to D (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 nn_Callback(hObject, eventdata, handles)
% hObject handle to nn (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 nn as text
% str2double(get(hObject,'String')) returns contents of nn as a double
guidata(hObject,handles);
data=getappdata(gcbf,'Data');
set(handles.nn,'Enable','on');
data.nn=str2double(get(handles.nn,'string'));
set(handles.nn,'string',num2str(data.nn));
guidata(hObject,handles);
setappdata(gcbf,'Data',data);
OK_Callback(hObject, eventdata, handles)
% --- Executes during object creation, after setting all properties.
function nn_CreateFcn(hObject, eventdata, handles)
% hObject handle to nn (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 OK.
function OK_Callback(hObject, eventdata, handles)
% hObject handle to OK (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
guidata(hObject,handles);
data=getappdata(gcbf,'Data');
clc;
O1=str2double(get(handles.O1,'String
- 1
- 2
前往页