You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
why after making my executable gui some buttons do not work?
1 view (last 30 days)
Show older comments
I made a gui that links another 9 more, each one has a method in which it calculates and graphs. Before making it executable they worked for me but after doing it an .exe file and opening it some buttons do not work, why?
Answers (1)
Walter Roberson
on 5 Nov 2017
Did you specifically tell the compiler to add the files for the other GUIs ? If you used GUIDE then because of the way it constructs callbacks, it would be common for the compiler to not be able to figure out that some files were needed. You would need to either add the files specifically or you would need to use %#function pragmas. https://www.mathworks.com/help/compiler_sdk/ml_code/function.html
13 Comments
Erwin Avendaño
on 5 Nov 2017
If when I was asking for the files I needed to start the program add all the m files. and figure of each guide that used the program some buttons if they serve those that have simple actions such as delete, graph but the button calculate that takes in the method of how to solve, send results that button does not work what would it do? I'm really anguished it took me 5 days to do my program since it has 9 methods, graphics I do not want to lose everything: /
Walter Roberson
on 5 Nov 2017
Can you attach your code (zip it all up and attach the zip), along with a description of how you did the compiling, and also the steps that would be needed to reproduce the problem? If a data file is needed, include a sample data file so we can test.
Erwin Avendaño
on 5 Nov 2017
are 10 codes I repeat are 9 methods and the guide 10 is the main window. I will attach a code so that I can analyze if it has something bad but I repeat I try it and if it works but the error arises after compiling and executing the .exe some buttons no longer work, well only the calculating one no longer works. In a moment I attach a code and I show how to compile
Erwin Avendaño
on 5 Nov 2017
As a question, does it have anything to do with those orange stripes that appear on the right side? some I gave fix but not even an I function in the executable
Erwin Avendaño
on 5 Nov 2017
function varargout = metodo2(varargin) % METODO2 MATLAB code for metodo2.fig % METODO2, by itself, creates a new METODO2 or raises the existing % singleton*. % % H = METODO2 returns the handle to a new METODO2 or the handle to % the existing singleton*. % % METODO2('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in METODO2.M with the given input arguments. % % METODO2('Property','Value',...) creates a new METODO2 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before metodo2_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to metodo2_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 metodo2
% Last Modified by GUIDE v2.5 05-Nov-2017 10:22:45
% Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @metodo2_OpeningFcn, ... 'gui_OutputFcn', @metodo2_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 metodo2 is made visible. function metodo2_OpeningFcn(hObject, ~, handles, varargin) movegui(gcf,'center')
axes(handles.axes1) imshow('logo.jpg') axes(handles.axes3) imshow('recuadro.jpg') axes(handles.axes4) imshow('recuadro.jpg') axes(handles.axes5) imshow('recuadro.jpg') axes(handles.axes6) imshow('recuadro.jpg') axes(handles.axes7) imshow('recuadro.jpg') axes(handles.axes11) imshow('recuadro.jpg') axes(handles.axes12) imshow('biseccion.jpg')
handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes metodo2 wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = metodo2_OutputFcn(~, ~, 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;
function edit1_Callback(~, ~, ~) % hObject handle to edit1 (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 edit1 as text % str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties. function edit1_CreateFcn(hObject, ~, ~) % hObject handle to edit1 (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 creation, after setting all properties. function axes1_CreateFcn(~, ~, ~) % hObject handle to axes1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1
function pushbutton1_Callback(~, ~, ~) % hObject handle to pushbutton1 (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 pushbutton1 as text % str2double(get(hObject,'String')) returns contents of pushbutton1 as a double
% --- Executes on button press in pushbutton3. function pushbutton3_Callback(~, ~, handles) syms x %variable simbolica x f=get(handles.edit8,'string'); xl=str2double(get(handles.edit3,'string')); xu=str2double(get(handles.edit5,'string')); tol=str2double(get(handles.edit4,'string')); E=100; xa=100; i=0; while(tol<E) xr=(xl+xu)/2; fxl=subs(f,x,xl); fxr=subs(f,x,xr); m=fxl*fxr; if(m)<0
xu=xr;
else
xl=xr;
end
E=abs(xr-xa);
xa=xr;
i=i+1;
end
xr;
vpa(E,5)
set(handles.edit6,'string',xr);
set(handles.edit9,'string',E);
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(~, ~, handles)
f=inline(get(handles.edit8,'string')); xl=str2double(get(handles.edit3,'string')); xu=str2double(get(handles.edit5,'string'));
if xl~=xu axes(handles.axes2); ezplot(f,[xl,xu]),grid on; else axes(handles.axes2); ezplot(f),grid on;
end function edit3_Callback(~, ~, ~)
% --- Executes during object creation, after setting all properties. function edit3_CreateFcn(hObject, ~, ~) % hObject handle to edit3 (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 edit4_Callback(~, ~, ~)
% --- Executes during object creation, after setting all properties. function edit4_CreateFcn(hObject, ~, ~) % hObject handle to edit4 (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 edit5_Callback(~, ~, ~)
% --- Executes during object creation, after setting all properties. function edit5_CreateFcn(hObject, ~, ~) % hObject handle to edit5 (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 edit6_Callback(~, ~, ~)
function edit6_CreateFcn(hObject, ~, ~) % hObject handle to edit6 (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 creation, after setting all properties. function edit7_CreateFcn(~, ~, ~) % hObject handle to edit7 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
function edit8_Callback(~, ~, ~) % hObject handle to edit8 (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 edit8 as text % str2double(get(hObject,'String')) returns contents of edit8 as a double
% --- Executes during object creation, after setting all properties. function edit8_CreateFcn(hObject, ~, ~) % hObject handle to edit8 (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 creation, after setting all properties. function axes2_CreateFcn(~, ~, ~) % hObject handle to axes2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes2
function edit9_Callback(~, ~, ~) % hObject handle to edit9 (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 edit9 as text % str2double(get(hObject,'String')) returns contents of edit9 as a double
% --- Executes during object creation, after setting all properties. function edit9_CreateFcn(hObject, ~, ~) % hObject handle to edit9 (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 pushbutton5. function pushbutton5_Callback(~, ~, ~) close(metodo2); metodo1
% --- Executes on button press in pushbutton6. function pushbutton6_Callback(~, ~, handles) set (handles.edit8, 'String', ''); set (handles.edit3, 'String', ''); set (handles.edit5, 'String', ''); set (handles.edit4, 'String', ''); set (handles.edit9, 'String', ''); set (handles.edit6, 'String', ''); axes(handles.axes2); cla reset
% --- Executes during object creation, after setting all properties. function axes12_CreateFcn(~, ~, ~) % hObject handle to axes12 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes12
% --- Executes during object creation, after setting all properties. function pushbutton4_CreateFcn(~, ~, ~) % hObject handle to pushbutton4 (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 axes5_CreateFcn(~, ~, ~) % hObject handle to axes5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes5
Erwin Avendaño
on 5 Nov 2017
Edited: Walter Roberson
on 6 Nov 2017
syms x %variable simbolica x
f=get(handles.edit8,'string');
xl=str2double(get(handles.edit3,'string'));
xu=str2double(get(handles.edit5,'string'));
tol=str2double(get(handles.edit4,'string'));
E=100;
xa=100;
i=0;
while(tol<E)
xr=(xl+xu)/2;
fxl=subs(f,x,xl);
fxr=subs(f,x,xr);
m=fxl*fxr;
if(m)<0
xu=xr;
else
xl=xr;
end
E=abs(xr-xa);
xa=xr;
i=i+1;
end
xr;
vpa(E,5)
set(handles.edit6,'string',xr);
set(handles.edit9,'string',E);
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(~, ~, handles)
f=inline(get(handles.edit8,'string'));
xl=str2double(get(handles.edit3,'string'));
xu=str2double(get(handles.edit5,'string'));
if xl~=xu
axes(handles.axes2);
ezplot(f,[xl,xu]),grid on;
else
axes(handles.axes2);
ezplot(f),grid on;
end
Walter Roberson
on 6 Nov 2017
The cause of this is the same as https://www.mathworks.com/matlabcentral/answers/365294-does-my-code-have-an-error#answer_289606 . It even looks to me as if that is a duplicate question . Duplicate questions keep the volunteers spending time cleaning up questions instead of spending time answering the questions.
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)