function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global zuobiao;
[FileName PathName]=uigetfile('*.xls','choss a file')
X=[PathName FileName]
zuobiao=xlsread(X);
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% 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)
global zuobiao;
k=size(zuobiao);
samplex=str2double(get(handles.samplex,'string'));
sampley=str2double(get(handles.sampley,'string'));
for i=1:k(1);
m=zuobiao(i,1);
n=zuobiao(i,2);
a=zuobiao(i,3);
b=zuobiao(i,4);
f=@(x,y)(x-m).^2/(a/2)^2+(y-n).^2/(b/2)^2-1;
axis(handles.axes1);
oval=ezplot(f,[0 samplex 0 sampley]);
C=get(oval,'contourMatrix');
x1=C(1,2:end);
y1=C(2,2:end);
fill(x1,y1,'g');
hold on;
end
function samplex_Callback(hObject, eventdata, handles)
% hObject handle to samplex (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 samplex as text
% str2double(get(hObject,'String')) returns contents of samplex as a double
% --- Executes during object creation, after setting all properties.
function samplex_CreateFcn(hObject, eventdata, handles)
% hObject handle to samplex (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 sampley_Callback(hObject, eventdata, handles)
% hObject handle to sampley (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 sampley as text
% str2double(get(hObject,'String')) returns contents of sampley as a double
% --- Executes during object creation, after setting all properties.
function sampley_CreateFcn(hObject, eventdata, handles)
% hObject handle to sampley (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 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)
try
delete(allchild(handles.axes1));
set(handles.samplex,'string','');
set(handles.sampley,'string','');
end