matlab机械设计带传动之GUI电算设计

来源:互联网 发布:制作单页用什么软件 编辑:程序博客网 时间:2024/06/10 16:25

%机械设计带传动之GUI电算设计

%author:李四林

%data:2015.10.25


function varargout = GUI_MachineDesign(varargin)

% GUI_MACHINEDESIGN MATLAB code for GUI_MachineDesign.fig
%      GUI_MACHINEDESIGN, by itself, creates a new GUI_MACHINEDESIGN or raises the existing
%      singleton*.
%
%      H = GUI_MACHINEDESIGN returns the handle to a new GUI_MACHINEDESIGN or the handle to
%      the existing singleton*.
%
%      GUI_MACHINEDESIGN('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GUI_MACHINEDESIGN.M with the given input arguments.
%
%      GUI_MACHINEDESIGN('Property','Value',...) creates a new GUI_MACHINEDESIGN or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before GUI_MachineDesign_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to GUI_MachineDesign_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help GUI_MachineDesign

% Last Modified by GUIDE v2.5 25-Oct-2015 17:30:46

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GUI_MachineDesign_OpeningFcn, ...
                   'gui_OutputFcn',  @GUI_MachineDesign_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before GUI_MachineDesign is made visible.
function GUI_MachineDesign_OpeningFcn(hObject, eventdata, handles, varargin)
% ----------------加入图片
% bucla = importdata('清除.jpg');
% set(handles.BUTTON_CLEAR,'CDATA',bucla);
% cal = importdata('计算.jpg');
% set(handles.cal1,'CDATA',cal);

% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to GUI_MachineDesign (see VARARGIN)

% Choose default command line output for GUI_MachineDesign
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes GUI_MachineDesign wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = GUI_MachineDesign_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on selection change in Load.
function Load_Callback(hObject, eventdata, handles)
% hObject    handle to Load (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns Load contents as cell array
%        contents{get(hObject,'Value')} returns selected item from Load


% --- Executes during object creation, after setting all properties.
function Load_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Load (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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 selection change in motor_type.
function motor_type_Callback(hObject, eventdata, handles)
% hObject    handle to motor_type (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns motor_type contents as cell array
%        contents{get(hObject,'Value')} returns selected item from motor_type


% --- Executes during object creation, after setting all properties.
function motor_type_CreateFcn(hObject, eventdata, handles)
% hObject    handle to motor_type (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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 selection change in work_time.
function work_time_Callback(hObject, eventdata, handles)
% hObject    handle to work_time (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns work_time contents as cell array
%        contents{get(hObject,'Value')} returns selected item from work_time


% --- Executes during object creation, after setting all properties.
function work_time_CreateFcn(hObject, eventdata, handles)
% hObject    handle to work_time (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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

% --------------------------------------------------------
% 1.计算设计功率
function P_Callback(hObject, eventdata, handles)

% --------------------------------------------------------
% hObject    handle to P (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 P as text
%        str2double(get(hObject,'String')) returns contents of P as a double


% --- Executes during object creation, after setting all properties.
function P_CreateFcn(hObject, eventdata, handles)
% hObject    handle to P (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


% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (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 pushbutton3.
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes during object deletion, before destroying properties.

% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes during object deletion, before destroying properties.

% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)




% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double



function Pd_Callback(hObject, eventdata, handles)
% hObject    handle to Pd (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 Pd as text
%        str2double(get(hObject,'String')) returns contents of Pd as a double


% --- Executes during object creation, after setting all properties.
function Pd_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Pd (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 belt_type_Callback(hObject, eventdata, handles)
% hObject    handle to belt_type (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 belt_type as text
%        str2double(get(hObject,'String')) returns contents of belt_type as a double


% --- Executes during object creation, after setting all properties.
function belt_type_CreateFcn(hObject, eventdata, handles)
% hObject    handle to belt_type (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 belt_speed_Callback(hObject, eventdata, handles)
% hObject    handle to belt_speed (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 belt_speed as text
%        str2double(get(hObject,'String')) returns contents of belt_speed as a double


% --- Executes during object creation, after setting all properties.
function belt_speed_CreateFcn(hObject, eventdata, handles)
% hObject    handle to belt_speed (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 belt_length_Callback(hObject, eventdata, handles)
% hObject    handle to belt_length (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 belt_length as text
%        str2double(get(hObject,'String')) returns contents of belt_length as a double


% --- Executes during object creation, after setting all properties.
function belt_length_CreateFcn(hObject, eventdata, handles)
% hObject    handle to belt_length (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 cen_distan_Callback(hObject, eventdata, handles)
% hObject    handle to cen_distan (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 cen_distan as text
%        str2double(get(hObject,'String')) returns contents of cen_distan as a double


% --- Executes during object creation, after setting all properties.
function cen_distan_CreateFcn(hObject, eventdata, handles)
% hObject    handle to cen_distan (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 corner_Callback(hObject, eventdata, handles)
% hObject    handle to corner (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 corner as text
%        str2double(get(hObject,'String')) returns contents of corner as a double


% --- Executes during object creation, after setting all properties.
function corner_CreateFcn(hObject, eventdata, handles)
% hObject    handle to corner (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 belt_num_Callback(hObject, eventdata, handles)
% hObject    handle to belt_num (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 belt_num as text
%        str2double(get(hObject,'String')) returns contents of belt_num as a double


% --- Executes during object creation, after setting all properties.
function belt_num_CreateFcn(hObject, eventdata, handles)
% hObject    handle to belt_num (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 F0_Callback(hObject, eventdata, handles)
% hObject    handle to F0 (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 F0 as text
%        str2double(get(hObject,'String')) returns contents of F0 as a double


% --- Executes during object creation, after setting all properties.
function F0_CreateFcn(hObject, eventdata, handles)
% hObject    handle to F0 (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 FQ_Callback(hObject, eventdata, handles)
% hObject    handle to FQ (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 FQ as text
%        str2double(get(hObject,'String')) returns contents of FQ as a double


% --- Executes during object creation, after setting all properties.
function FQ_CreateFcn(hObject, eventdata, handles)
% hObject    handle to FQ (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 cal1.
function cal1_Callback(hObject, eventdata, handles)

i = get(handles.Load,'value');
j = get(handles.work_time,'value') * get(handles.motor_type,'value');
P = str2num(get(handles.P,'string'));
ka = importdata('KA.txt');
% -------计算设计功率
Pd = ka(i,j) * P;
set(handles.Pd,'string',num2str(Pd));

% ----计算带型
a=imread('1.JPG');
axes(handles.axes4);
imshow(a);



%---------------------------------------------------------------

% hObject    handle to cal1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (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 edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double



function n1_Callback(hObject, eventdata, handles)
% hObject    handle to n1 (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 n1 as text
%        str2double(get(hObject,'String')) returns contents of n1 as a double


% --- Executes during object creation, after setting all properties.
function n1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to n1 (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 trans_ratio_Callback(hObject, eventdata, handles)
% hObject    handle to trans_ratio (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 trans_ratio as text
%        str2double(get(hObject,'String')) returns contents of trans_ratio as a double


% --- Executes during object creation, after setting all properties.
function trans_ratio_CreateFcn(hObject, eventdata, handles)
% hObject    handle to trans_ratio (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 during object deletion, before destroying properties.

% hObject    handle to belt_type (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in cal2.
function cal2_Callback(hObject, eventdata, handles)
% ----------------------------------------------------------
%-----确定带轮基准直径
belt_ddmin = importdata('普通V带基本额定功率.txt');
belt_ddmin = belt_ddmin(:,1);

temp_ddmin = 4*get(handles.belt_type,'value');%带型选择比较紧凑

dd1 = belt_ddmin(temp_ddmin);
set(handles.belt1,'string', num2str(dd1));%显示dd1
%---确定P0横坐标索引
p0i = temp_ddmin;
%---确定P0纵坐标索引
n1 = str2num(get(handles.n1,'string'));

beltP01 = importdata('普通V带基本额定功率.txt');
beltP0 = beltP01(1,:);
for k=2:length(beltP0)
    if (beltP0(k) <= n1) & (n1 <= beltP0(k+1))
        if beltP0(k+1) - n1 < n1 - beltP0(k)%这一行曾经不小心写错了。。。。       
            p0j = k+1;
        else
            p0j = k;
        end
    end
end
%---确定P0
P0 = beltP01(p0i,p0j);


i = str2num(get(handles.trans_ratio,'string'));
dd22 = i*dd1;
%求出的dd2是最优解
belt_dd2 = [20 28 31.5 35.5 40 45 50 56 63 71 80 90 100 112 125 140 150 160 180 200 224 250 280 315 355 400 425 450 500 560 600 630 710 800];
for k = 1:length(belt_dd2)
    if (belt_dd2(k) <= dd22) & (dd22 <= belt_dd2(k+1))
        if (belt_dd2(k+1)-dd22) >= (dd22 - belt_dd2(k))
            dd2 = belt_dd2(k);
        else
            dd2 = belt_dd2(k+1);
        end
    end
end
set(handles.belt2,'string',num2str(dd2));

%---------验算带速

v = pi*dd1*n1/60000;
set(handles.belt_speed,'string',num2str(v));

a01 = 0.7*(dd1 + dd2);
a02 = 2*(dd1 + dd2);
a0 = ceil(a01/100)*100; %保证紧凑,取偏小值
Ldd = 2*a0 + pi/2*(dd1+dd2)+(dd2-dd1)^2/(4*a0);

%----确定长度系数KL
temp_Ld = xlsread('表5.2普通V带基准长度Ld及长度系数KL.xlsx');
for k = 1:length(temp_Ld(:,1))
    if temp_Ld(k,1) <= Ldd & temp_Ld(k+1,1) >= Ldd
        if temp_Ld(k+1,1)-Ldd > Ldd-temp_Ld(k,1)  
            Ld = temp_Ld(k,1);
            KLi = k;
        else
            Ld = temp_Ld(k+1,1);
            KLi = k+1;  
        end
    end
end
set(handles.belt_length,'string',num2str(Ld));
KLj = get(handles.belt_type,'value')+1;
KL = temp_Ld(KLi,KLj);

% ----计算实际中心距a
a = a0 + (Ld-Ldd)/2;
set(handles.cen_distan,'string',num2str(a));
% ------计算包角alpha1
alpha1 = 180 - (dd2-dd1)/a*57.3;
set(handles.corner,'string',num2str(alpha1));

%-------计算带根数
temp_Kb =  importdata('弯曲影响系数Kb.txt');
Kb = temp_Kb(get(handles.belt_type,'value'));
temp_Ki = importdata('传动比系数.txt');
for k = 1:length(temp_Ki(:,1))
    if n1 >= temp_Ki(k,1)%巧妙,我太尼玛聪明了,哈哈
        Ki = temp_Ki(k,2);
    end
end
deltP0 = Kb*n1*(1-1/Ki);
%---求Kα
%采用曲线拟合

% temp_Kalpha = importdata('包角修正系数.txt');
% x = temp_Kalpha(:,1);
% y = temp_Kalpha(:,2);
% polyfit(x,y,3);
% for i=1:5
%
%     y2=polyfit(x,y,i);
%
%     Y=polyval(y2,x);%计算拟合函数在x处的值。
%
%     if sum((Y-y).^2)<0.1
%
%       
%
%         c=i  
%
%         break;
%
%     end
%
% end

Kalpha = 0.0037*alpha1 + 0.3617;

%--带根数z
Pd = str2num(get(handles.Pd,'string'));
z = round(Pd/((P0+deltP0)*Kalpha*KL));
set(handles.belt_num,'string',num2str(z));

% ---初拉力
temp_m = importdata('普通V带单位长度质量.txt');
m = temp_m(get(handles.belt_type,'value'));
F0 = 500*Pd*(2.5/Kalpha-1)/(v*z)+m*v^2;
set(handles.F0,'string',num2str(F0));
%----计算FQ
FQ = 2*z*F0*sin(alpha1/2*pi/180);%默认弧度制
set(handles.FQ,'string',num2str(FQ));


% -------------------------------------------------------------
% hObject    handle to cal2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



function belt1_Callback(hObject, eventdata, handles)
% hObject    handle to belt1 (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 belt1 as text
%        str2double(get(hObject,'String')) returns contents of belt1 as a double


% --- Executes during object creation, after setting all properties.
function belt1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to belt1 (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 belt2_Callback(hObject, eventdata, handles)
% hObject    handle to belt2 (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 belt2 as text
%        str2double(get(hObject,'String')) returns contents of belt2 as a double


% --- Executes during object creation, after setting all properties.
function belt2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to belt2 (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 BUTTON_CLEAR.
function BUTTON_CLEAR_Callback(hObject, eventdata, handles)
%---------------------------------------------------
%清除数据返回默认值
set(handles.Load,'value',1);
set(handles.motor_type,'value',1);
set(handles.work_time,'value',1);
set(handles.P,'string',' ');
set(handles.Pd,'string',' ');
set(handles.belt_type,'value',1);
set(handles.n1,'string',' ');
set(handles.trans_ratio,'string',' ');
set(handles.belt1,'string',' ');
set(handles.belt2,'string',' ');
set(handles.belt_speed,'string',' ');
set(handles.cen_distan,'string',' ');
set(handles.corner,'string',' ');
set(handles.belt_num,'string',' ');set(handles.cen_distan,'string',' ');
set(handles.F0,'string',' ');
set(handles.FQ,'string',' ');
% ------------------------------------------------

% hObject    handle to BUTTON_CLEAR (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes during object creation, after setting all properties.
% hObject    handle to BUTTON_CLEAR (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


% --- Executes during object creation, after setting all properties.
function BUTTON_CLEAR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to BUTTON_CLEAR (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called


1 0
原创粉丝点击