Info
此问题已关闭。 请重新打开它进行编辑或回答。
GUI make button to start the function / from existing function/?
2 次查看(过去 30 天)
显示 更早的评论
Hy
I have question..:
I have function this:
function adjustRobot(hObject,handles,theta1,theta2,theta3)
for theta1 =theta1:-1:0
point1.x =0;point1.y = 0;point1.z = 0; % [point2,point3,point4] = fromDHandTheta(theta1,theta2,theta3); %(each individual theta) [point2,point3,point4] = fromDHandTheta(theta1,theta1,theta1); %(each individual theta) set(handles.l,'ZData',[point1.z,point2.z],'YData',[point1.y,point2.y],'XData',[point1.x,point2.x]); set(handles.l1,'ZData',[point2.z,point3.z],'YData',[point2.y,point3.y],'XData',[point2.x,point3.x]); set(handles.l2,'ZData',[point3.z,point4.z],'YData',[point3.y,point4.y],'XData',[point3.x,point4.x]); % WHENEVER THE ROBOT IS ADJUSTED, IT SHOULD BE UPDATED ON TEXT BOXES % CURRENTLY, YOU ARE TRYING TO DO IT IN THE CALLBACK OF THE EDIT BOX. THE % CALLBACK WILL ONLY BE TRIGGERED IF YOU CLICK ON THE TEXT BOX
%UPDATE CODE (I have also disabled the textboxes(since you donot want them
%to be editable)
set(handles.edit4,'String',num2str(point4.x));
set(handles.edit5,'String',num2str(point4.y));
set(handles.edit6,'String',num2str(point4.z));
guidata(hObject,handles);
hold on;
plot3(point4.x,point4.y,point4.z,'xk');
pause(0.1);
end
From this function how to create button ,who start this function in GUI ? When I go on right click in GUI editor,on the pushbutton and >> view callback > createfcn this create code like this:
function pushbutton1_CreateFcn(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
and when I put under this code, this start,create new function ...but I need this line
function adjustRobot(hObject,handles,theta1,theta2,theta3)
beacuse some values is need the function adjustRobot. But I need to start this function after I pushed the button.
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!