Problem in using gui

1 次查看(过去 30 天)
Mohammed Abdul-Wahab
When I am using matlab gui checkbox, I asked him to disable a popubmineo and edit box at the start but its not doing that, when I run the code and tick the mark two times he is disable it as it must be at the start, please help

回答(1 个)

Mohammed Abdul-Wahab
function varargout = newACI(varargin) % NEWACI MATLAB code for newACI.fig % NEWACI, by itself, creates a new NEWACI or raises the existing % singleton*. % % H = NEWACI returns the handle to a new NEWACI or the handle to % the existing singleton*. % % NEWACI('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in NEWACI.M with the given input arguments. % % NEWACI('Property','Value',...) creates a new NEWACI or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before newACI_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to newACI_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 newACI
% Last Modified by GUIDE v2.5 01-Nov-2020 18:04:13
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @newACI_OpeningFcn, ... 'gui_OutputFcn', @newACI_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 newACI is made visible. function newACI_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 newACI (see VARARGIN)
% Choose default command line output for newACI handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes newACI wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = newACI_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 button press in Calculate. function Calculate_Callback(hObject, eventdata, handles) % hObject handle to Calculate (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) spg=str2double(get(handles.spg, 'string')); sps=str2double(get(handles.sps, 'string')); spl=str2double(get(handles.spl, 'string')); spw=str2double(get(handles.spw, 'string')); RS=str2double(get(handles.RS, 'string')); bd=str2double(get(handles.bd, 'string')); T112=str2double(get(handles.T112, 'string')); T113_response=get(handles.T1133fixed, 'value'); CheckTestRec=get(handles.TestRec,'Value'); CheckAirYes=get(handles.AirYes,'Value') MNS_response=get(handles.MNS, 'value'); exp_response=get(handles.exp, 'value'); Slump_response=get(handles.Slump, 'value'); FMS_response=get(handles.FMS, 'value');
if CheckTestRec==1
kVals=[3.09,2.5,2.33,1.96,1.64,1.5,1.28,1];
CS=RS+T112*(kVals(T113_response));
else
if RS <= 21
Ks=7;
elseif RS > 21 & RS <= 35
Ks=8.5;
else
Ks=10;
end
CS=RS+Ks;
end
x=CS*10;
if CheckAirYes==0 %non air entrained
p1 = 1.818e-11;
p2 = -2.404e-08;
p3 = 1.329e-05;
p4 = -0.004792;
p5 = 1.291;
wcr = p1*x^4 + p2*x^3 + p3*x^2 + p4*x + p5
else
p1 = -6.667e-09;
p2 = 7.571e-06;
p3 = -0.004019;
p4 = 1.165;
wcr = p1*x^3 + p2*x^2 + p3*x + p4
end
NonEntWaterCont=[205,200,185,180,160,155,145,125;225,215,200,195,175,170,160,140;240,230,210,205,185,180,170,0];
NonEntVoid=[3,2.5,2,1.5,1,0.5,0.3,0.2];
EntWaterCont=[180,175,165,160,145,140,135,120;200,190,180,175,160,155,150,135;215,205,190,185,170,165,160,0];
EntVoid=[4.5,4,3.5,3,2.5,2,1.5,1;6,5.5,5,4.5,4.5,4,3.5,3;7.5,7,6,6,5.5,5,4.5,4;];
Entgra=[0.50,0.48,0.46,0.44;0.59,0.57,0.55,0.53;0.66,0.64,0.62,0.60;0.71,0.69,0.67,0.65;0.75,0.73,0.71,0.69;0.78,0.76,0.74,0.72;0.82,0.80,0.78,0.76];
gravelcontent=Entgra(MNS_response,FMS_response)
ena=[2285;2315;2355;2375;2420;2445;2465];
ea=[2190;2235;2280;2315;2355;2375;2400];
if CheckAirYes==0
Estw=ena(MNS_response)
else
Estw=ea(MNS_response)
end
if CheckAirYes==0 %non air entrained
WaterContent=NonEntWaterCont(Slump_response,MNS_response)
VoidContent=NonEntVoid(MNS_response)
else
WaterContent=EntWaterCont(Slump_response,MNS_response)
VoidContent=EntVoid(exp_response,MNS_response)
end
c=WaterContent/wcr
Gravel=bd*gravelcontent
S = ((1000*(1- VoidContent/100))-(c/spl)-(WaterContent/spw)-(Gravel/spg))*sps
totw=S+WaterContent+Gravel+c
corfactor=(Estw)/(totw)
cement=corfactor*c;
Water=corfactor*WaterContent;
Sand=corfactor*S;
Grave=corfactor*Gravel;
set(handles.cement, 'string', cement); set(handles.Water, 'string', Water); set(handles.Sand, 'string', Sand); set(handles.Grave, 'string', Grave); set(handles.void, 'string', VoidContent);
% --- Executes on button press in AirYes. function AirYes_Callback(hObject, eventdata, handles) % hObject handle to AirYes (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 AirYes CheckAirYes=get(handles.AirYes,'Value'); if CheckAirYes==1 set(handles.exp,'Enable','On')
else
set(handles.exp,'Enable','Off')
end
% --- Executes on selection change in exp. function exp_Callback(hObject, eventdata, handles) % hObject handle to exp (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 exp contents as cell array % contents{get(hObject,'Value')} returns selected item from exp
% --- Executes during object creation, after setting all properties. function exp_CreateFcn(hObject, eventdata, handles) % hObject handle to exp (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 button press in TestRec. function TestRec_Callback(hObject, eventdata, handles) % hObject handle to TestRec (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 TestRec CheckTestRec=get(handles.TestRec,'Value'); if CheckTestRec==1 set(handles.T112,'Enable','On') set(handles.T1133fixed,'Enable','On') else set(handles.T112,'Enable','Off') set(handles.T1133fixed,'Enable','Off') end
% --- Executes on selection change in T1133fixed. function T1133fixed_Callback(hObject, eventdata, handles) % hObject handle to T1133fixed (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 T1133fixed contents as cell array % contents{get(hObject,'Value')} returns selected item from T1133fixed
% --- Executes during object creation, after setting all properties. function T1133fixed_CreateFcn(hObject, eventdata, handles) % hObject handle to T1133fixed (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 T112_Callback(hObject, eventdata, handles) % hObject handle to T112 (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 T112 as text % str2double(get(hObject,'String')) returns contents of T112 as a double
% --- Executes during object creation, after setting all properties. function T112_CreateFcn(hObject, eventdata, handles) % hObject handle to T112 (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 selection change in MNS. function MNS_Callback(hObject, eventdata, handles) % hObject handle to MNS (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 MNS contents as cell array % contents{get(hObject,'Value')} returns selected item from MNS
% --- Executes during object creation, after setting all properties. function MNS_CreateFcn(hObject, eventdata, handles) % hObject handle to MNS (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 Slump. function Slump_Callback(hObject, eventdata, handles) % hObject handle to Slump (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 Slump contents as cell array % contents{get(hObject,'Value')} returns selected item from Slump
% --- Executes during object creation, after setting all properties. function Slump_CreateFcn(hObject, eventdata, handles) % hObject handle to Slump (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 FMS. function FMS_Callback(hObject, eventdata, handles) % hObject handle to FMS (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 FMS contents as cell array % contents{get(hObject,'Value')} returns selected item from FMS
% --- Executes during object creation, after setting all properties. function FMS_CreateFcn(hObject, eventdata, handles) % hObject handle to FMS (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 RS_Callback(hObject, eventdata, handles) % hObject handle to RS (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 RS as text % str2double(get(hObject,'String')) returns contents of RS as a double
% --- Executes during object creation, after setting all properties. function RS_CreateFcn(hObject, eventdata, handles) % hObject handle to RS (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 bd_Callback(hObject, eventdata, handles) % hObject handle to bd (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 bd as text % str2double(get(hObject,'String')) returns contents of bd as a double
% --- Executes during object creation, after setting all properties. function bd_CreateFcn(hObject, eventdata, handles) % hObject handle to bd (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 spw_Callback(hObject, eventdata, handles) % hObject handle to spw (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 spw as text % str2double(get(hObject,'String')) returns contents of spw as a double
% --- Executes during object creation, after setting all properties. function spw_CreateFcn(hObject, eventdata, handles) % hObject handle to spw (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 sps_Callback(hObject, eventdata, handles) % hObject handle to sps (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 sps as text % str2double(get(hObject,'String')) returns contents of sps as a double
% --- Executes during object creation, after setting all properties. function sps_CreateFcn(hObject, eventdata, handles) % hObject handle to sps (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 spg_Callback(hObject, eventdata, handles) % hObject handle to spg (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 spg as text % str2double(get(hObject,'String')) returns contents of spg as a double
% --- Executes during object creation, after setting all properties. function spg_CreateFcn(hObject, eventdata, handles) % hObject handle to spg (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 spl_Callback(hObject, eventdata, handles) % hObject handle to spl (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 spl as text % str2double(get(hObject,'String')) returns contents of spl as a double
% --- Executes during object creation, after setting all properties. function spl_CreateFcn(hObject, eventdata, handles) % hObject handle to spl (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

类别

Help CenterFile Exchange 中查找有关 Labels and Annotations 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by