📄 simuladorcs.m
字号:
printdlg('-setup',handles.figure1);
%printdlg(handles.figure1);%Imprimir Dados
%printdlg('-crossplatform',handles.figure1);
% --------------------------------------------------------------------
function ajuda_Callback(hObject, eventdata, handles)
% hObject handle to ajuda (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Acerca_Callback(hObject, eventdata, handles)
% hObject handle to Acerca (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%openfig('Acerca.fig','new');% Abre novo figure file
Acerca;
function editPX_Callback(hObject, eventdata, handles)
% hObject handle to editPX (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 editPX as text
% str2double(get(hObject,'String')) returns contents of editPX as a double
% --- Executes during object creation, after setting all properties.
function editPX_CreateFcn(hObject, eventdata, handles)
% hObject handle to editPX (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editPY_Callback(hObject, eventdata, handles)
% hObject handle to editPY (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 editPY as text
% str2double(get(hObject,'String')) returns contents of editPY as a double
% --- Executes during object creation, after setting all properties.
function editPY_CreateFcn(hObject, eventdata, handles)
% hObject handle to editPY (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editPZ_Callback(hObject, eventdata, handles)
% hObject handle to editPZ (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 editPZ as text
% str2double(get(hObject,'String')) returns contents of editPZ as a double
pz = str2num(get(handles.editPZ,'String'));
if(pz<0 || pz>180)
errordlg('Dist鈔cia Invalida:Digite um valor entre 0 e 180 ','Erro','on')
set(handles.editPZ,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function editPZ_CreateFcn(hObject, eventdata, handles)
% hObject handle to editPZ (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit15_Callback(hObject, eventdata, handles)
% hObject handle to edit15 (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 edit15 as text
% str2double(get(hObject,'String')) returns contents of edit15 as a double
% --- Executes during object creation, after setting all properties.
function edit15_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit15 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit16_Callback(hObject, eventdata, handles)
% hObject handle to edit16 (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 edit16 as text
% str2double(get(hObject,'String')) returns contents of edit16 as a double
% --- Executes during object creation, after setting all properties.
function edit16_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit16 (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 fundoaxes on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit17_Callback(hObject, eventdata, handles)
% hObject handle to edit17 (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 edit17 as text
% str2double(get(hObject,'String')) returns contents of edit17 as a double
% --- Executes during object creation, after setting all properties.
function edit17_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit17 (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 fundoaxes 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 tbrodar.
function tbrodar_Callback(hObject, eventdata, handles)
% hObject handle to tbrodar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of tbrodar
rodar = get(hObject,'Value');
axes(handles.axes1);
if rodar==1
rotate3d on;
[a,map,b]=imread('_Rodar_On.JPG');
set(handles.tbrodar,'CData',a);
else
rotate3d off;
[a,map,b]=imread('_Rodar_Off.JPG');
set(handles.tbrodar,'CData',a);
end
axes(handles.axes1);
% --- Executes on button press in pbrestaurar.
function pbrestaurar_Callback(hObject, eventdata, handles)
% hObject handle to pbrestaurar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global flag_joy
flag_joy=0;
reset(handles.axes1);
axis on
axis([-100 100 -100 100 -100 100]);
Iniciar_variaveis; %%%%%%%%inicia variaveis
Inicia_Matriz_Objecto; %%%%%%%%%%%%Iniciar todas as matirzes referentes as faces dos objectos
set(handles.editteta1,'String','0','Enable','off');
set(handles.editteta4,'String','90','Enable','off');
set(handles.editteta5,'String','0','Enable','off');
set(handles.editteta6,'String','0','Enable','off');
set(handles.editd2,'String','90','Enable','off');
set(handles.editd3,'String','125','Enable','off');
set(handles.editPX,'Enable','off','String','110');
set(handles.editPY,'Enable','off','String','-150');
set(handles.editPZ,'Enable','off','String','90');
set(handles.edittetaf,'Enable','off','String','90');
set(handles.edittetap,'Enable','off','String','0');
set(handles.textd2,'String',get(handles.editd2,'String'));
set(handles.textd3,'String',get(handles.editd3,'String'));
set(handles.textteta1,'String',get(handles.editteta1,'String'));
set(handles.textteta4,'String',get(handles.editteta4,'String'));
set(handles.textteta5,'String',get(handles.editteta5,'String'));
set(handles.textteta6,'String',get(handles.editteta6,'String'));
set(handles.textpx,'String','110');
set(handles.textpy,'String','-150');
set(handles.textpz,'String','90');
set(handles.texttetaf,'String','90');
set(handles.texttetap,'String','0');
[a,map,b]=imread('_Rodar_Off.JPG');
set(handles.tbrodar,'CData',a);
[a,map,b]=imread('_Reset_.JPG');
set(handles.pbrestaurar,'CData',a);
[a,map,b]=imread('_Zoom_Off.JPG');
set(handles.tbzoom,'CData',a);
[a,map,b]=imread('_Cursor_Off.JPG');
set(handles.tbDataCursor,'CData',a);
set(handles.rbjoyistick,'Value',1);
Desenha_robo(hObject, eventdata,handles); %Matlab 7.3
%SimuladorCs('Desenha_robo',hObject, eventdata,handles); %Matlab 7.1
% --- Executes on button press in tbzoom.
function tbzoom_Callback(hObject, eventdata, handles)
% hObject handle to tbzoom (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of tbzoom
zoomx = get(hObject,'Value');
axes(handles.axes1);
if zoomx==1
zoom on;
[a,map,b]=imread('_Zoom_On.JPG');
set(handles.tbzoom,'CData',a);
else
zoom off;
[a,map,b]=imread('_Zoom_Off.JPG');
set(handles.tbzoom,'CData',a);
end
axes(handles.axes1);
% --- Executes on button press in tbDataCursor.
function tbDataCursor_Callback(hObject, eventdata, handles)
% hObject handle to tbDataCursor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of tbDataCursor
datacursorx = get(hObject,'Value');
axes(handles.axes1);
if datacursorx==1
datacursormode on;
[a,map,b]=imread('_Cursor_On.JPG');
set(handles.tbDataCursor,'CData',a);
else
datacursormode off;
[a,map,b]=imread('_Cursor_Off.JPG');
set(handles.tbDataCursor,'CData',a);
end
axes(handles.axes1);
function edittetaf_Callback(hObject, eventdata, handles)
% hObject handle to edittetaf (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 edittetaf as text
% str2double(get(hObject,'String')) returns contents of edittetaf as a double
Tetaf = str2num(get(handles.edittetaf,'String'));
if(Tetaf<-360 || Tetaf>360)
errordlg('耼gulo Invalido:Digite um valor entre -360?e 360?','Erro','on')
set(handles.edittetaf,'String',' '); %limpar a caixa
end
% --- Executes during object creation, after setting all properties.
function edittetaf_CreateFcn(hObject, eventdata, handles)
% hObject handle to edittetaf (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 edittetap_Callback(hObject, eventdata, handles)
% hObject handle to edittetap (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 edittetap as text
% str2double(get(hObject,'String')) returns contents of edittetap as a double
Tetap = str2num(get(handles.edittetap,'String'));
if(Tetap<-90 || Tetap>90)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -