필터 지우기
필터 지우기

patch in GUI (rectangular parallelepiped)

조회 수: 3 (최근 30일)
Modestas Sekreckis
Modestas Sekreckis 2011년 4월 6일
hi, I have a problem. I try to use the GUI, and I need to graphics with rectangular parallelepiped. Whose parameters are entered in the table. I am trying to use the command "patch" and it worked well until the second time does not change the parameters of a ectangular parallelepiped. When I change them, graph remains with two rectangular parallelepipeds (old and new together). how can I avoid this? Or, as yet, otherwise can draw a rectangle parallelepiped? Below, my m-file code snippet.
% --- Executes when entered data in editable cell(s) in kliutis.
function kliutis_CellEditCallback(hObject, eventdata, handles)
% hObject handle to kliutis (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) edited
% PreviousData: previous data for the cell(s) edited
% EditData: string(s) entered by the user
% NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
% Error: error string when failed to convert EditData to appropriate value for Data
% handles structure with handles and user data (see GUIDATA)
a=get(hObject,'data');
xk=[a(1,1) a(1,2)];
yk=[a(2,1) a(2,2)];
zk=[a(3,1) a(3,2)];
kx3=[xk(1,1) xk(1,2) xk(1,2) xk(1,1);xk(1,1) xk(1,2) xk(1,2) xk(1,1);...
xk(1,1) xk(1,1) xk(1,2) xk(1,2); xk(1,1) xk(1,1) xk(1,2) xk(1,2);...
xk(1,1) xk(1,1) xk(1,1) xk(1,1); xk(1,2) xk(1,2) xk(1,2) xk(1,2);];
ky3=[yk(1,1) yk(1,1) yk(1,2) yk(1,2); yk(1,1) yk(1,1) yk(1,2) yk(1,2);...
yk(1,1) yk(1,1) yk(1,1) yk(1,1);yk(1,2) yk(1,2) yk(1,2) yk(1,2);...
yk(1,1) yk(1,2) yk(1,2) yk(1,1);yk(1,1) yk(1,2) yk(1,2) yk(1,1);];
kz3=[zk(1,1) zk(1,1) zk(1,1) zk(1,1);zk(1,2) zk(1,2) zk(1,2) zk(1,2);...
zk(1,1) zk(1,2) zk(1,2) zk(1,1);zk(1,1) zk(1,2) zk(1,2) zk(1,1);...
zk(1,1) zk(1,1) zk(1,2) zk(1,2);zk(1,1) zk(1,1) zk(1,2) zk(1,2);];
patch(kx3(1,:),ky3(1,:),kz3(1,:),'r')
patch(kx3(2,:),ky3(2,:),kz3(2,:),'r')
patch(kx3(3,:),ky3(3,:),kz3(3,:),'r')
patch(kx3(4,:),ky3(4,:),kz3(4,:),'r')
patch(kx3(5,:),ky3(5,:),kz3(5,:),'r')
patch(kx3(6,:),ky3(6,:),kz3(6,:),'r')

채택된 답변

Sean de Wolski
Sean de Wolski 2011년 4월 6일
perhaps
doc cla
to clear the axes.

추가 답변 (1개)

Matt Fig
Matt Fig 2011년 4월 6일

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by