patch in GUI (rectangular parallelepiped)
조회 수: 4 (최근 30일)
이전 댓글 표시
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')
댓글 수: 0
채택된 답변
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!