Help !!!!!!! fix this GUI plz..............

function varargout = test11(varargin)
% TEST11 MATLAB code for test11.fig
% TEST11, by itself, creates a new TEST11 or raises the existing
% singleton*.
%
% H = TEST11 returns the handle to a new TEST11 or the handle to
% the existing singleton*.
%
% TEST11('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TEST11.M with the given input arguments.
%
% TEST11('Property','Value',...) creates a new TEST11 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before test11_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to test11_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 test11
% Last Modified by GUIDE v2.5 29-Mar-2018 19:29:04
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @test11_OpeningFcn, ...
'gui_OutputFcn', @test11_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 test11 is made visible.
function test11_OpeningFcn(hObject, eventdata, handles, varargin)
% 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 test11 (see VARARGIN)
% Choose default command line output for test11
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes test11 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = test11_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 popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (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 popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
contents=cellstr(get(hObject,'String'));
popChoice=contents(get(hObject,'Value'));
if(strcmp(popChoice,'Ball bearing'))
Choice=1;
p=1/3;
elseif(strcmp(popChoice,'Roller bearing'))
Choice=2;
p=0.3;
elseif(strcmp(popChoice,'Taper roller bearing'))
Choice=3;
end
assignin('base','Choice',Choice);
assignin('base','p',p);
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (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
function i_C_Callback(hObject, eventdata, handles)
% hObject handle to i_C (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 i_C as text
% str2double(get(hObject,'String')) returns contents of i_C as a double
% --- Executes during object creation, after setting all properties.
function i_C_CreateFcn(hObject, eventdata, handles)
% hObject handle to i_C (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 i_L10h_Callback(hObject, eventdata, handles)
% hObject handle to i_L10h (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 i_L10h as text
% str2double(get(hObject,'String')) returns contents of i_L10h as a double
% --- Executes during object creation, after setting all properties.
function i_L10h_CreateFcn(hObject, eventdata, handles)
% hObject handle to i_L10h (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 i_L10_Callback(hObject, eventdata, handles)
% hObject handle to i_L10 (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 i_L10 as text
% str2double(get(hObject,'String')) returns contents of i_L10 as a double
% --- Executes during object creation, after setting all properties.
function i_L10_CreateFcn(hObject, eventdata, handles)
% hObject handle to i_L10 (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 n_Callback(hObject, eventdata, handles)
% hObject handle to n (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 n as text
% str2double(get(hObject,'String')) returns contents of n as a double
% --- Executes during object creation, after setting all properties.
function n_CreateFcn(hObject, eventdata, handles)
% hObject handle to n (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 dia_Callback(hObject, eventdata, handles)
% hObject handle to dia (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 dia as text
% str2double(get(hObject,'String')) returns contents of dia as a double
% --- Executes during object creation, after setting all properties.
function dia_CreateFcn(hObject, eventdata, handles)
% hObject handle to dia (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 load_factor_Callback(hObject, eventdata, handles)
% hObject handle to load_factor (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 load_factor as text
% str2double(get(hObject,'String')) returns contents of load_factor as a double
% --- Executes during object creation, after setting all properties.
function load_factor_CreateFcn(hObject, eventdata, handles)
% hObject handle to load_factor (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 Fr_Callback(hObject, eventdata, handles)
% hObject handle to Fr (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 Fr as text
% str2double(get(hObject,'String')) returns contents of Fr as a double
% --- Executes during object creation, after setting all properties.
function Fr_CreateFcn(hObject, eventdata, handles)
% hObject handle to Fr (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 Fr2_Callback(hObject, eventdata, handles)
% hObject handle to Fr2 (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 Fr2 as text
% str2double(get(hObject,'String')) returns contents of Fr2 as a double
% --- Executes during object creation, after setting all properties.
function Fr2_CreateFcn(hObject, eventdata, handles)
% hObject handle to Fr2 (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 solve.
function solve_Callback(hObject, eventdata, handles)
% hObject handle to solve (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
i_C=str2num(get(handles.i_C,'string'));
i_L10h=str2num(get(handles.i_L10h,'string'));
i_L10=str2num(get(handles.i_L10,'string'));
i_n=str2double(get(handles.n,'string'));
i_dia=str2double(get(handles.dia,'string'));
load_factor=str2double(get(handles.load_factor,'string'));
Fr1=str2double(get(handles.Fr,'string'));
Fr2=str2double(get(handles.Fr2,'string'));
Fa=str2double(get(handles.Fa,'string'));
v=str2double(get(handles.V,'string'));
assignin('base','C',i_C);
assignin('base','L10h',i_L10h);
assignin('base','L10',i_L10);
assignin('base','n',i_n);
assignin('base','dia',i_dia);
assignin('base','load_factor',load_factor);
assignin('base','Fr',Fr1);
assignin('base','Fr2',Fr2);
assignin('base','Fa',Fa);
assignin('base','V',v);
P=Fr;
L10=L10h_L10(L10h,n);
fprintf(['\nL10: %i millioin rev.\n '],L10)
Old_C=P*(L10^p);
fprintf('\nDynamic load is %4.2f N\n',Old_C)
%Step II(Selection of bearing)
Table_dia=find(d==dia);
C_of_that_dia=Table_dia+5;
Select_C=C(Table_dia:C_of_that_dia);
Subtracting_C=(abs(Select_C-Old_C));
min_C=min(Subtracting_C);
new_C = find(Subtracting_C==min_C);
if(Old_C>C(new_C+dia-3))
new_C=new_C+1;
else
new_C=new_C;
end
final_D=D((dia+new_C-3));
final_B=B((dia+new_C-3));
final_C=C((dia+new_C-3));
final_C0=C0((dia+new_C-3));
set(handles.D,'String',final_D)
set(handles.B,'String',final_B)
set(handles.C,'String',final_C)
set(handles.C0,'String',final_C)
set(handles.Designation,'String',final_Designation)
function Fa_Callback(hObject, eventdata, handles)
% hObject handle to Fa (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 Fa as text
% str2double(get(hObject,'String')) returns contents of Fa as a double
% --- Executes during object creation, after setting all properties.
function Fa_CreateFcn(hObject, eventdata, handles)
% hObject handle to Fa (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 edit20_Callback(hObject, eventdata, handles)
% hObject handle to edit20 (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 edit20 as text
% str2double(get(hObject,'String')) returns contents of edit20 as a double
% --- Executes during object creation, after setting all properties.
function edit20_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit20 (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 edit21_Callback(hObject, eventdata, handles)
% hObject handle to edit21 (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 edit21 as text
% str2double(get(hObject,'String')) returns contents of edit21 as a double
% --- Executes during object creation, after setting all properties.
function edit21_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit21 (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 edit22_Callback(hObject, eventdata, handles)
% hObject handle to edit22 (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 edit22 as text
% str2double(get(hObject,'String')) returns contents of edit22 as a double
% --- Executes during object creation, after setting all properties.
function edit22_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit22 (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 edit23_Callback(hObject, eventdata, handles)
% hObject handle to edit23 (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 edit23 as text
% str2double(get(hObject,'String')) returns contents of edit23 as a double
% --- Executes during object creation, after setting all properties.
function edit23_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit23 (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 edit24_Callback(hObject, eventdata, handles)
% hObject handle to edit24 (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 edit24 as text
% str2double(get(hObject,'String')) returns contents of edit24 as a double
% --- Executes during object creation, after setting all properties.
function edit24_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit24 (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 V_Callback(hObject, eventdata, handles)
% hObject handle to V (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 V as text
% str2double(get(hObject,'String')) returns contents of V as a double
% --- Executes during object creation, after setting all properties.
function V_CreateFcn(hObject, eventdata, handles)
% hObject handle to V (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

댓글 수: 2

Geoff Hayes
Geoff Hayes 2018년 3월 29일
Saurao - you will need to say more than fix this GUI. Please provide some details as to what is wrong with it. If you are observing an error, then please copy and paste the full error message to this question.
Remember, without the GUI fig file, we cannot run the above code so you will need to tell us exactly what you are doing when the error occurs.
Saurao Dalvi
Saurao Dalvi 2018년 3월 30일
I have attached the fig file. The static txt handles (hadels.D,...) are not proving output of function "ball_bearing"

답변 (0개)

이 질문은 마감되었습니다.

태그

질문:

2018년 3월 29일

댓글:

2018년 3월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by