matlab只画一半,GUI个别图像在坐标轴里为什么只画一半,有代码有图

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值